This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Fix execute/20000225-1.c


Hi,

finally I got annoyed enough to look at this testcase and fixed it. The fix 
is based on Jose's patch:

<http://gcc.gnu.org/ml/gcc-patches/2000-01/msg00783.html>

and Jeff's comments here:

<http://gcc.gnu.org/ml/gcc-patches/2000-02/msg00828.html>

It fixes the testcase and bootstraps without regression on powerpc-linux-gnu.

OK to commit?

Franz.

2000-09-28  Jose Luu  <jluu@mainsoft.com>
	        Franz Sirl <Franz.Sirl-kernel@lauterbach.com>

	* loop.c (check_final_value): A GIV is not replaceable if used before the
	set.

Index: gcc/loop.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/loop.c,v
retrieving revision 1.288
diff -u -p -r1.288 loop.c
--- loop.c	2000/09/19 16:01:13	1.288
+++ loop.c	2000/09/28 17:04:06
@@ -5094,6 +5094,7 @@ check_final_value (loop, v)
         or all uses follow that insn in the same basic block),
      - its final value can be calculated (this condition is different
        than the one above in record_giv)
+     - it's not used before it's set
      - no assignments to the biv occur during the giv's lifetime.  */
 
 #if 0
@@ -5105,7 +5106,7 @@ check_final_value (loop, v)
   if ((final_value = final_giv_value (loop, v))
       && (v->always_computable || last_use_this_basic_block (v->dest_reg, v->insn)))
     {
-      int biv_increment_seen = 0;
+      int biv_increment_seen = 0, before_giv_insn = 0;
       rtx p = v->insn;
       rtx last_giv_use;
 
@@ -5135,7 +5136,10 @@ check_final_value (loop, v)
 	{
 	  p = NEXT_INSN (p);
 	  if (p == loop->end)
-	    p = NEXT_INSN (loop->start);
+	    {
+	      before_giv_insn = 1;
+	      p = NEXT_INSN (loop->start);
+	    }
 	  if (p == v->insn)
 	    break;
 
@@ -5153,7 +5157,7 @@ check_final_value (loop, v)
 
 	      if (reg_mentioned_p (v->dest_reg, PATTERN (p)))
 		{
-		  if (biv_increment_seen)
+		  if (biv_increment_seen || before_giv_insn)
 		    {
 		      v->replaceable = 0;
 		      v->not_replaceable = 1;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]