aboutsummaryrefslogtreecommitdiff
path: root/gcc/lambda-code.c
diff options
context:
space:
mode:
authorDaniel Berlin <dberlin@dberlin.org>2004-11-17 02:51:55 +0000
committerDaniel Berlin <dberlin@gcc.gnu.org>2004-11-17 02:51:55 +0000
commit13cf683781930f8de94b751c62d7f0c4f50bbecc (patch)
treea69f8c518df4f108376addac249336f3a3c3529d /gcc/lambda-code.c
parent354ed18fbdb5cc66777bd445463810332ac362c5 (diff)
downloadgcc-13cf683781930f8de94b751c62d7f0c4f50bbecc.zip
gcc-13cf683781930f8de94b751c62d7f0c4f50bbecc.tar.gz
gcc-13cf683781930f8de94b751c62d7f0c4f50bbecc.tar.bz2
lambda-code.c (lambda_loopnest_to_gcc_loopnest): Swap the test when the edge has the opposite meaning...
2004-11-16 Daniel Berlin <dberlin@dberlin.org> * lambda-code.c (lambda_loopnest_to_gcc_loopnest): Swap the test when the edge has the opposite meaning, not when the first argument is invariant. From-SVN: r90788
Diffstat (limited to 'gcc/lambda-code.c')
-rw-r--r--gcc/lambda-code.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c
index 2e1d851..96d9798 100644
--- a/gcc/lambda-code.c
+++ b/gcc/lambda-code.c
@@ -1867,6 +1867,7 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
{
lambda_loop newloop;
basic_block bb;
+ edge exit;
tree ivvar, ivvarinced, exitcond, stmts;
enum tree_code testtype;
tree newupperbound, newlowerbound;
@@ -1908,6 +1909,7 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
type,
new_ivs,
invariants, MIN_EXPR, &stmts);
+ exit = temp->single_exit;
exitcond = get_loop_exit_condition (temp);
bb = bb_for_stmt (exitcond);
bsi = bsi_start (bb);
@@ -1928,14 +1930,13 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
testtype = LL_STEP (newloop) >= 0 ? LE_EXPR : GE_EXPR;
- /* Since we don't know which cond_expr part currently points to each
- edge, check which one is invariant and make sure we reverse the
- comparison if we are trying to replace a <= 50 with 50 >= newiv.
- This ensures that we still canonicalize to <invariant> <test>
- <induction variable>. */
- if (!expr_invariant_in_loop_p (temp, TREE_OPERAND (exitcond, 0)))
+ /* We want to build a conditional where true means exit the loop, and
+ false means continue the loop.
+ So swap the testtype if this isn't the way things are.*/
+
+ if (exit->flags & EDGE_FALSE_VALUE)
testtype = swap_tree_comparison (testtype);
-
+
COND_EXPR_COND (exitcond) = build (testtype,
boolean_type_node,
newupperbound, ivvarinced);