PATCH: PR 16590

Jeffrey A Law law@redhat.com
Tue Aug 31 20:38:00 GMT 2004


On Tue, 2004-08-31 at 00:31, Mark Mitchell wrote:
> Jeffrey A Law wrote:
> >But more importantly, I don't see how that REG_EQUAL note is
> >incorrect.
> >
> OK, I have reverted the patch on the 3.4 branch and on the mainline.
Here's a patch for gcc-3.4 that ought to fix the problem in the
correct manner.

Basically we already had all the necessary code to invalidate 
REG_EQUAL/REG_EQUIV notes when we performed store motions.
That code tries to be smart and avoid potentially costly 
walks through the insn chains.  Unfortunately one of the
tests to avoid walking the insn chains was incorrect.

Specifically we avoided walking the insn chains for blocks where
the store expression was killed.  Unfortunately, that's incorrect
as we might have a REG_EQUAL/REG_EQUIV note in such a block
before whatever insn causes the store expression to be killed
in the block.

I'm 99% sure we'll want the same patch for the mainline; I'll be
testing that next...

	* gcse.c (remove_reachable_equiv_notes): Scan loops where
	the store expression is killed for REG_EQUAL/REG_EQUIV
	notes that need to be removed.

	
Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.288.2.6
diff -c -p -r1.288.2.6 gcse.c
*** gcse.c	31 Aug 2004 06:28:33 -0000	1.288.2.6
--- gcse.c	31 Aug 2004 19:59:19 -0000
*************** remove_reachable_equiv_notes (basic_bloc
*** 7777,7785 ****
  	}
        bb = act->dest;
        
        if (bb == EXIT_BLOCK_PTR
! 	  || TEST_BIT (visited, bb->index)
! 	  || TEST_BIT (ae_kill[bb->index], smexpr->index))
  	{
  	  act = act->succ_next;
  	  continue;
--- 7777,7790 ----
  	}
        bb = act->dest;
        
+       /* We used to continue the loop without scanning this block if
the
+ 	 store expression was killed in this block.  That is wrong as
+ 	 we could have had a REG_EQUAL note with the store expression
+ 	 appear in the block before the insn which killed the store
+ 	 expression and that REG_EQUAL note needs to be removed as it
+ 	 is invalid.  */
        if (bb == EXIT_BLOCK_PTR
! 	  || TEST_BIT (visited, bb->index))
  	{
  	  act = act->succ_next;
  	  continue;




More information about the Gcc-patches mailing list