diff options
author | Daniel Berlin <dberlin@dberlin.org> | 2005-04-11 18:55:47 +0000 |
---|---|---|
committer | Daniel Berlin <dberlin@gcc.gnu.org> | 2005-04-11 18:55:47 +0000 |
commit | e5e656a499b7dd38b1ae9d7ddac4c6413963374a (patch) | |
tree | 9b4105c0a8a37d97ca82b634c1476dd065030f67 /gcc/lambda-code.c | |
parent | d3010d7286ad5f894ef662ea189c201f2a724290 (diff) | |
download | gcc-e5e656a499b7dd38b1ae9d7ddac4c6413963374a.zip gcc-e5e656a499b7dd38b1ae9d7ddac4c6413963374a.tar.gz gcc-e5e656a499b7dd38b1ae9d7ddac4c6413963374a.tar.bz2 |
re PR tree-optimization/20612 (ICE in verify_ssa for -ftree-loop-linear)
2005-04-11 Daniel Berlin <dberlin@dberlin.org>
Fix PR tree-optimization/20612
* lambda-code.c (lambda_loopnest_to_gcc_loopnest): Fix increment
handling
(perfect_nestify): preheaderbb is *not* part of loop of the
old destination.
From-SVN: r97979
Diffstat (limited to 'gcc/lambda-code.c')
-rw-r--r-- | gcc/lambda-code.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c index 80e5478..5b23d6d 100644 --- a/gcc/lambda-code.c +++ b/gcc/lambda-code.c @@ -1874,6 +1874,7 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest, lambda_linear_expression offset; tree type; bool insert_after; + tree inc_stmt; oldiv = VEC_index (tree, old_ivs, i); type = TREE_TYPE (oldiv); @@ -1922,7 +1923,20 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest, create_iv (newlowerbound, build_int_cst (type, LL_STEP (newloop)), ivvar, temp, &bsi, insert_after, &ivvar, - &ivvarinced); + NULL); + + /* Unfortunately, the incremented ivvar that create_iv inserted may not + dominate the block containing the exit condition. + So we simply create our own incremented iv to use in the new exit + test, and let redundancy elimination sort it out. */ + inc_stmt = build (PLUS_EXPR, type, + ivvar, build_int_cst (type, LL_STEP (newloop))); + inc_stmt = build (MODIFY_EXPR, void_type_node, SSA_NAME_VAR (ivvar), + inc_stmt); + ivvarinced = make_ssa_name (SSA_NAME_VAR (ivvar), inc_stmt); + TREE_OPERAND (inc_stmt, 0) = ivvarinced; + bsi = bsi_for_stmt (exitcond); + bsi_insert_before (&bsi, inc_stmt, BSI_SAME_STMT); /* Replace the exit condition with the new upper bound comparison. */ @@ -2375,7 +2389,6 @@ perfect_nestify (struct loops *loops, add_bb_to_loop (latchbb, newloop); add_bb_to_loop (bodybb, newloop); add_bb_to_loop (headerbb, newloop); - add_bb_to_loop (preheaderbb, olddest->loop_father); set_immediate_dominator (CDI_DOMINATORS, bodybb, headerbb); set_immediate_dominator (CDI_DOMINATORS, headerbb, preheaderbb); set_immediate_dominator (CDI_DOMINATORS, preheaderbb, |