diff mbox

Fix powerpc rs6000_stack_info ICE

Message ID 20110406121846.GR19002@bubble.grove.modra.org
State New
Headers show

Commit Message

Alan Modra April 6, 2011, 12:18 p.m. UTC
The ENABLE_CHECKING tests I added at the end of rs6000_stack_info
are now asserting on gcc.c-torture/execute/20041011-1.c and other
testcases.  The cause is the late running DSE pass removing a set of
LR, which means lr_save_p changes.  Why that happens ultimately goes
back to a register allocation decision to use LR after running out of
gprs, which isn't that bright in this case since there is just one set
and one use of LR and you need a gpr free to move values to and from
LR.  Anyway, the fact remains that the stack info can change
legitimately and harmlessly after we've emitted the function prologue
and epilogue.  So this patch simply removes the ENABLE_CHECKING code.
Bootstrapped and regtested powerpc64-linux.  OK for mainline?

	* config/rs6000/rs6000.c (rs6000_stack_info): Don't compare against
	previous stack info.

Comments

David Edelsohn April 6, 2011, 5:57 p.m. UTC | #1
On Wed, Apr 6, 2011 at 8:18 AM, Alan Modra <amodra@gmail.com> wrote:
> The ENABLE_CHECKING tests I added at the end of rs6000_stack_info
> are now asserting on gcc.c-torture/execute/20041011-1.c and other
> testcases.  The cause is the late running DSE pass removing a set of
> LR, which means lr_save_p changes.  Why that happens ultimately goes
> back to a register allocation decision to use LR after running out of
> gprs, which isn't that bright in this case since there is just one set
> and one use of LR and you need a gpr free to move values to and from
> LR.  Anyway, the fact remains that the stack info can change
> legitimately and harmlessly after we've emitted the function prologue
> and epilogue.  So this patch simply removes the ENABLE_CHECKING code.
> Bootstrapped and regtested powerpc64-linux.  OK for mainline?
>
>        * config/rs6000/rs6000.c (rs6000_stack_info): Don't compare against
>        previous stack info.

Okay.

Thanks, David
diff mbox

Patch

Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 171817)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -18774,9 +18776,6 @@  rs6000_savres_strategy (rs6000_stack_t *
 static rs6000_stack_t *
 rs6000_stack_info (void)
 {
-#ifdef ENABLE_CHECKING
-  static rs6000_stack_t info_save;
-#endif
   rs6000_stack_t *info_ptr = &stack_info;
   int reg_size = TARGET_32BIT ? 4 : 8;
   int ehrd_size;
@@ -18785,14 +18784,10 @@  rs6000_stack_info (void)
   HOST_WIDE_INT non_fixed_size;
   bool using_static_chain_p;
 
-#ifdef ENABLE_CHECKING
-  memcpy (&info_save, &stack_info, sizeof stack_info);
-#else
   if (reload_completed && info_ptr->reload_completed)
     return info_ptr;
-#endif
 
-  memset (&stack_info, 0, sizeof (stack_info));
+  memset (info_ptr, 0, sizeof (*info_ptr));
   info_ptr->reload_completed = reload_completed;
 
   if (TARGET_SPE)
@@ -19096,10 +19091,6 @@  rs6000_stack_info (void)
   if (! info_ptr->cr_save_p)
     info_ptr->cr_save_offset = 0;
 
-#ifdef ENABLE_CHECKING
-  gcc_assert (!(reload_completed && info_save.reload_completed)
-	      || memcmp (&info_save, &stack_info, sizeof stack_info) == 0);
-#endif
   return info_ptr;
 }