diff options
author | dberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-04-11 18:55:47 +0000 |
---|---|---|
committer | dberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-04-11 18:55:47 +0000 |
commit | b6f9596b0858327c4e0a32ef83f1589d4c8394d1 (patch) | |
tree | 9b4105c0a8a37d97ca82b634c1476dd065030f67 | |
parent | 0702744d3d81583923218f05236b092cbf9a4aaa (diff) | |
download | gcc-b6f9596b0858327c4e0a32ef83f1589d4c8394d1.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97979 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/lambda-code.c | 17 |
2 files changed, 23 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2c7195401c8..1a723feafa5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +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. + 2005-04-11 Andrew Pinski <pinskia@physics.uc.edu> * tree-ssa-alias.c (may_alias_p): If the variable diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c index 80e5478ec0d..5b23d6d5fa1 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, |