re PR rtl-optimization/16001 (unable to find a register to spill in class `AREG'...
authorZdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
Sun, 11 Jul 2004 02:52:54 +0000 (04:52 +0200)
committerZdenek Dvorak <rakdver@gcc.gnu.org>
Sun, 11 Jul 2004 02:52:54 +0000 (02:52 +0000)
PR rtl-optimization/16001
* loop-iv.c (iv_number_of_iterations): Prevent copy propagation in
niter_expr.

From-SVN: r84486

gcc/ChangeLog
gcc/loop-iv.c

index 851644f6b82b2a2ed1c9c7cd5924c715d5b80cec..a8e979df06cd1ffd6e3fe0bbb0ac58c1560588ca 100644 (file)
@@ -1,3 +1,9 @@
+2004-07-10  Zdenek Dvorak  <rakdver@atrey.karlin.mff.cuni.cz>
+
+       PR rtl-optimization/16001
+       * loop-iv.c (iv_number_of_iterations): Prevent copy propagation in
+       niter_expr.
+
 2004-07-10  Geoffrey Keating  <geoffk@apple.com>
 
        * config/darwin.h (LINK_COMMAND_SPEC): Don't call c++filt.
@@ -10,6 +16,7 @@
 
 2004-07-10  Zdenek Dvorak  <rakdver@atrey.karlin.mff.cuni.cz>
 
+       PR rtl-optimization/15387
        * calls.c (check_sibcall_argument_overlap_1): Handle pointers
        to incoming args space correctly.
 
index 965359c5931a30ead1c66d6c4b38b53f24da2685..f390cdd487c34c08cd7f400d26aa170cee98d9ec 100644 (file)
@@ -1967,6 +1967,7 @@ iv_number_of_iterations (struct loop *loop, rtx insn, rtx condition,
   unsigned HOST_WIDEST_INT s, size, d, inv;
   HOST_WIDEST_INT up, down, inc;
   int was_sharp = false;
+  rtx old_niter;
 
   /* The meaning of these assumptions is this:
      if !assumptions
@@ -2366,6 +2367,8 @@ iv_number_of_iterations (struct loop *loop, rtx insn, rtx condition,
       desc->niter_expr = delta;
     }
 
+  old_niter = desc->niter_expr;
+
   simplify_using_initial_values (loop, AND, &desc->assumptions);
   if (desc->assumptions
       && XEXP (desc->assumptions, 0) == const0_rtx)
@@ -2408,8 +2411,19 @@ iv_number_of_iterations (struct loop *loop, rtx insn, rtx condition,
       desc->const_iter = true;
       desc->niter_max = desc->niter = val & GET_MODE_MASK (desc->mode);
     }
-  else if (!desc->niter_max)
-    desc->niter_max = determine_max_iter (desc);
+  else
+    {
+      if (!desc->niter_max)
+       desc->niter_max = determine_max_iter (desc);
+
+      /* simplify_using_initial_values does a copy propagation on the registers
+        in the expression for the number of iterations.  This prolongs life
+        ranges of registers and increases register pressure, and usually
+        brings no gain (and if it happens to do, the cse pass will take care
+        of it anyway).  So prevent this behavior, unless it enabled us to
+        derive that the number of iterations is a constant.  */
+      desc->niter_expr = old_niter;
+    }
 
   return;