From 0ecf4c72a69f0db734dd13a69a47d8f0acb42abf Mon Sep 17 00:00:00 2001 From: dberlin Date: Wed, 17 Nov 2004 02:51:55 +0000 Subject: [PATCH] 2004-11-16 Daniel Berlin * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@90788 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/lambda-code.c | 15 ++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index def3930b570..1461084c592 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-11-16 Daniel Berlin + + * 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. + 2004-11-16 Aldy Hernandez * config/rs6000/rs6000.c (rs6000_override_options): Split e500v2 diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c index 2e1d85107b5..96d9798aabd 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 - . */ - 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); -- 2.11.0