From 8c28738553be95f56611db36923bf2d4db2577d6 Mon Sep 17 00:00:00 2001 From: bje Date: Thu, 26 Aug 2004 13:15:20 +0000 Subject: [PATCH] * loop-iv.c (simplify_using_initial_values): Store e->src in a temporary so that we count the predecessor edges from the correct basic block (since `e' is reassigned). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/edge-vector-branch@86620 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.vec | 6 ++++++ gcc/loop-iv.c | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog.vec b/gcc/ChangeLog.vec index e347a271ba1..1bb1540cee5 100644 --- a/gcc/ChangeLog.vec +++ b/gcc/ChangeLog.vec @@ -1,3 +1,9 @@ +2004-08-26 Ben Elliston + + * loop-iv.c (simplify_using_initial_values): Store e->src in a + temporary so that we count the predecessor edges from the correct + basic block (since `e' is reassigned). + 2004-08-23 Ben Elliston * predict.c (propagate_freq): Reformat comment to minimise diffs. diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c index 5b0ab0a9145..2dcbb820ddb 100644 --- a/gcc/loop-iv.c +++ b/gcc/loop-iv.c @@ -1764,6 +1764,8 @@ simplify_using_initial_values (struct loop *loop, enum rtx_code op, rtx *expr) while (1) { + basic_block tmp_bb; + insn = BB_END (e->src); if (any_condjump_p (insn)) { @@ -1795,8 +1797,12 @@ simplify_using_initial_values (struct loop *loop, enum rtx_code op, rtx *expr) } } - e = EDGE_PRED (e->src, 0); - if (EDGE_COUNT (e->src->preds) > 1 + /* This is a bit subtle. Store away e->src in tmp_bb, since we + modify `e' and this can invalidate the subsequent count of + e->src's predecessors by looking at the wrong block. */ + tmp_bb = e->src; + e = EDGE_PRED (tmp_bb, 0); + if (EDGE_COUNT (tmp_bb->preds) > 1 || e->src == ENTRY_BLOCK_PTR) break; } -- 2.11.4.GIT