aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1997-06-25 16:53:40 -0700
committerJim Wilson <wilson@gcc.gnu.org>1997-06-25 16:53:40 -0700
commitdb2f7559b5938986a643d60152eac4b9f8b5433b (patch)
tree268eedb0b3cdc3c501cf512d5950d943790fa774
parentf9317f0d751914dc72d58516900a972d4ffa8410 (diff)
downloadgcc-db2f7559b5938986a643d60152eac4b9f8b5433b.zip
gcc-db2f7559b5938986a643d60152eac4b9f8b5433b.tar.gz
gcc-db2f7559b5938986a643d60152eac4b9f8b5433b.tar.bz2
(final_giv_value): Verify that bl->initial_value is
invariant before trying to use it. From-SVN: r14323
-rw-r--r--gcc/unroll.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/unroll.c b/gcc/unroll.c
index 3f5c548..23bf6d3 100644
--- a/gcc/unroll.c
+++ b/gcc/unroll.c
@@ -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 */