Index: gcc/config/avr/avr.c
===================================================================
--- gcc/config/avr/avr.c	(revision 134897)
+++ gcc/config/avr/avr.c	(working copy)
@@ -471,8 +471,10 @@
   int reg, count;
   int int_or_sig_p = (interrupt_function_p (current_function_decl)
 		      || signal_function_p (current_function_decl));
-  int leaf_func_p = leaf_function_p ();
 
+  if (!reload_completed)
+    cfun->machine->is_leaf = leaf_function_p ();
+
   if (set)
     CLEAR_HARD_REG_SET (*set);
   count = 0;
@@ -490,7 +492,7 @@
       if (fixed_regs[reg])
 	continue;
 
-      if ((int_or_sig_p && !leaf_func_p && call_used_regs[reg])
+      if ((int_or_sig_p && !cfun->machine->is_leaf && call_used_regs[reg])
 	  || (df_regs_ever_live_p (reg)
 	      && (int_or_sig_p || !call_used_regs[reg])
 	      && !(frame_pointer_needed
Index: gcc/config/avr/avr.h
===================================================================
--- gcc/config/avr/avr.h	(revision 134897)
+++ gcc/config/avr/avr.h	(working copy)
@@ -1026,6 +1026,9 @@
    This is added to the cfun structure.  */
 struct machine_function GTY(())
 {
+  /* TRUE if the current function is a leaf function.  */
+  int is_leaf;
+
   /* 'true' - if current function is a naked function.  */
   int is_naked;
 
