resource.c (init_resource_info): Only consider EXIT_IGNORE_STACK if there is in epilogue.
authorRichard Sandiford <rdsandiford@googlemail.com>
Mon, 5 Dec 2011 19:32:16 +0000 (19:32 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 5 Dec 2011 19:32:16 +0000 (19:32 +0000)
gcc/
* resource.c (init_resource_info): Only consider EXIT_IGNORE_STACK
if there is in epilogue.

From-SVN: r182023

gcc/ChangeLog
gcc/resource.c

index 762c57f9b3ad419c649d19a810361e88a9d9fab5..cc9001094e00bdf3c38ef705d231ac592995384a 100644 (file)
@@ -1,3 +1,8 @@
+2011-12-05  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * resource.c (init_resource_info): Only consider EXIT_IGNORE_STACK
+       if there is in epilogue.
+
 2011-12-05  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * optabs.c (maybe_emit_sync_lock_test_and_set): Pass a null target
index 1a8cb1be4944a5c4a6816b9f5d5b38569dc8eb42..e5fa91f778edc4e1a6acceae40ee6bc2bb319980 100644 (file)
@@ -1145,11 +1145,11 @@ init_resource_info (rtx epilogue_insn)
   basic_block bb;
 
   /* Indicate what resources are required to be valid at the end of the current
-     function.  The condition code never is and memory always is.  If the
-     frame pointer is needed, it is and so is the stack pointer unless
-     EXIT_IGNORE_STACK is nonzero.  If the frame pointer is not needed, the
-     stack pointer is.  Registers used to return the function value are
-     needed.  Registers holding global variables are needed.  */
+     function.  The condition code never is and memory always is.
+     The stack pointer is needed unless EXIT_IGNORE_STACK is true
+     and there is an epilogue that restores the original stack pointer
+     from the frame pointer.  Registers used to return the function value
+     are needed.  Registers holding global variables are needed.  */
 
   end_of_function_needs.cc = 0;
   end_of_function_needs.memory = 1;
@@ -1162,11 +1162,11 @@ init_resource_info (rtx epilogue_insn)
 #if !HARD_FRAME_POINTER_IS_FRAME_POINTER
       SET_HARD_REG_BIT (end_of_function_needs.regs, HARD_FRAME_POINTER_REGNUM);
 #endif
-      if (! EXIT_IGNORE_STACK
-         || current_function_sp_is_unchanging)
-       SET_HARD_REG_BIT (end_of_function_needs.regs, STACK_POINTER_REGNUM);
     }
-  else
+  if (!(frame_pointer_needed
+       && EXIT_IGNORE_STACK
+       && epilogue_insn
+       && !current_function_sp_is_unchanging))
     SET_HARD_REG_BIT (end_of_function_needs.regs, STACK_POINTER_REGNUM);
 
   if (crtl->return_rtx != 0)