OSDN Git Service

(final_giv_value): Verify that bl->initial_value is
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 25 Jun 1997 23:53:40 +0000 (23:53 +0000)
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 25 Jun 1997 23:53:40 +0000 (23:53 +0000)
invariant before trying to use it.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@14323 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/unroll.c

index 3f5c548..23bf6d3 100644 (file)
@@ -3205,9 +3205,14 @@ final_giv_value (v, loop_start, loop_end)
         determine whether giv's are replaceable so that we can use the
         biv value here if it is not eliminable.  */
 
+      /* We are emitting code after the end of the loop, so we must make
+        sure that bl->initial_value is still valid then.  It will still
+        be valid if it is invariant.  */
+
       increment = biv_total_increment (bl, loop_start, loop_end);
 
-      if (increment && invariant_p (increment))
+      if (increment && invariant_p (increment)
+         && invariant_p (bl->initial_value))
        {
          /* Can calculate the loop exit value of its biv as
             (loop_n_iterations * increment) + initial_value */