]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/7409 (loop optimization)
authorUlrich Weigand <uweigand@de.ibm.com>
Tue, 15 Oct 2002 14:42:52 +0000 (14:42 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Tue, 15 Oct 2002 14:42:52 +0000 (14:42 +0000)
PR opt/7409
* loop.c (loop_regs_scan): Mark registers used for function
argument passing as MAY_NOT_OPTIMIZE.

From-SVN: r58160

gcc/ChangeLog
gcc/loop.c

index bc48fcf5d882c1581cb1840a3e176fc52fa24a97..e6168d245eb071f0f563785066aa8fda1d26be10 100644 (file)
@@ -1,3 +1,9 @@
+2002-10-15  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       PR opt/7409
+       * loop.c (loop_regs_scan): Mark registers used for function
+       argument passing as MAY_NOT_OPTIMIZE.
+
 2002-10-14  Neil Booth  <neil@daikokuya.co.uk>
 
        PR preprocessor/7862
index 732a84d64b72deccde7a8d183dee02c98052bd0f..149e7d1b97b43f8384db0bc6bfc0403cdffc5f1d 100644 (file)
@@ -9560,6 +9560,25 @@ loop_regs_scan (loop, extra_size)
 
       if (GET_CODE (insn) == CODE_LABEL || GET_CODE (insn) == JUMP_INSN)
        memset (last_set, 0, regs->num * sizeof (rtx));
+
+      /* Invalidate all registers used for function argument passing.
+        We check rtx_varies_p for the same reason as below, to allow
+        optimizing PIC calculations.  */
+      if (GET_CODE (insn) == CALL_INSN)
+       {
+         rtx link;
+         for (link = CALL_INSN_FUNCTION_USAGE (insn); 
+              link; 
+              link = XEXP (link, 1))
+           {
+             rtx op, reg;
+
+             if (GET_CODE (op = XEXP (link, 0)) == USE
+                 && GET_CODE (reg = XEXP (op, 0)) == REG
+                 && rtx_varies_p (reg, 1))
+               regs->array[REGNO (reg)].may_not_optimize = 1;
+           }
+       }
     }
 
   /* Invalidate all hard registers clobbered by calls.  With one exception: