From 306d9c02ee0801d023909806fa094ff68a8578b8 Mon Sep 17 00:00:00 2001 From: bonzini Date: Thu, 2 Feb 2006 13:05:36 +0000 Subject: [PATCH] 2006-02-02 Paolo Bonzini * tree-flow-inline.h (bsi_after_labels): Rewrite, return what its name says. * lambda-code.c (perfect_nestify): Use bsi_insert_before on bsi_after_labels iterator. * tree-if-conv.c (find_phi_replacement_condition, replace_phi_with_cond_modify_expr): Likewise. * tree-scalar-evolution.c (scev_const_prop): Likewise. * tree-ssa-loop-ivopts.c (compute_phi_arg_on_exit): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110514 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 +++++++++++ gcc/lambda-code.c | 2 +- gcc/tree-flow-inline.h | 30 ++++-------------------------- gcc/tree-if-conv.c | 7 ++----- gcc/tree-scalar-evolution.c | 7 +++++-- gcc/tree-ssa-loop-ivopts.c | 11 ++++++----- 6 files changed, 29 insertions(+), 39 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7c6288e8104..078ea9d8afd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2006-02-02 Paolo Bonzini + + * tree-flow-inline.h (bsi_after_labels): Rewrite, return + what its name says. + * lambda-code.c (perfect_nestify): Use bsi_insert_before on + bsi_after_labels iterator. + * tree-if-conv.c (find_phi_replacement_condition, + replace_phi_with_cond_modify_expr): Likewise. + * tree-scalar-evolution.c (scev_const_prop): Likewise. + * tree-ssa-loop-ivopts.c (compute_phi_arg_on_exit): Likewise. + 2006-02-02 Diego Novillo * tree-inline.c (copy_tree_r): Also copy OMP_CLAUSE nodes. diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c index c19ea6cfa54..ee1d1692e47 100644 --- a/gcc/lambda-code.c +++ b/gcc/lambda-code.c @@ -2556,7 +2556,7 @@ perfect_nestify (struct loops *loops, newname = make_ssa_name (newname, newstmt); TREE_OPERAND (newstmt, 0) = newname; SET_USE (use_p, TREE_OPERAND (newstmt, 0)); - bsi_insert_after (&tobsi, newstmt, BSI_SAME_STMT); + bsi_insert_before (&tobsi, newstmt, BSI_SAME_STMT); update_stmt (newstmt); update_stmt (imm_stmt); } diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h index 69bef68f9ac..0ae99b9f0d4 100644 --- a/gcc/tree-flow-inline.h +++ b/gcc/tree-flow-inline.h @@ -734,37 +734,15 @@ bsi_start (basic_block bb) } /* Return a block statement iterator that points to the first non-label - block BB. */ + statement in block BB. */ static inline block_stmt_iterator bsi_after_labels (basic_block bb) { - block_stmt_iterator bsi; - tree_stmt_iterator next; - - bsi.bb = bb; - - if (!bb->stmt_list) - { - gcc_assert (bb->index < NUM_FIXED_BLOCKS); - bsi.tsi.ptr = NULL; - bsi.tsi.container = NULL; - return bsi; - } - - bsi.tsi = tsi_start (bb->stmt_list); - if (tsi_end_p (bsi.tsi)) - return bsi; + block_stmt_iterator bsi = bsi_start (bb); - next = bsi.tsi; - tsi_next (&next); - - while (!tsi_end_p (next) - && TREE_CODE (tsi_stmt (next)) == LABEL_EXPR) - { - bsi.tsi = next; - tsi_next (&next); - } + while (!bsi_end_p (bsi) && TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR) + bsi_next (&bsi); return bsi; } diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index 8c41e9454bc..97deb2843f2 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -737,8 +737,7 @@ find_phi_replacement_condition (struct loop *loop, tree new_stmt; new_stmt = ifc_temp_var (TREE_TYPE (*cond), unshare_expr (*cond)); - bsi_insert_after (bsi, new_stmt, BSI_SAME_STMT); - bsi_next (bsi); + bsi_insert_before (bsi, new_stmt, BSI_SAME_STMT); *cond = TREE_OPERAND (new_stmt, 0); } @@ -804,9 +803,7 @@ replace_phi_with_cond_modify_expr (tree phi, tree cond, basic_block true_bb, SSA_NAME_DEF_STMT (PHI_RESULT (phi)) = new_stmt; /* Insert using iterator. */ - bsi_insert_after (bsi, new_stmt, BSI_SAME_STMT); - bsi_next (bsi); - + bsi_insert_before (bsi, new_stmt, BSI_SAME_STMT); update_stmt (new_stmt); if (dump_file && (dump_flags & TDF_DETAILS)) diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index 3075839f3e7..462d78fb39e 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -2793,8 +2793,11 @@ scev_const_prop (void) ass = build2 (MODIFY_EXPR, void_type_node, rslt, NULL_TREE); SSA_NAME_DEF_STMT (rslt) = ass; - bsi_insert_after (&bsi, ass, BSI_NEW_STMT); - def = force_gimple_operand_bsi (&bsi, def, false, NULL_TREE); + { + block_stmt_iterator dest = bsi; + bsi_insert_before (&dest, ass, BSI_NEW_STMT); + def = force_gimple_operand_bsi (&dest, def, false, NULL_TREE); + } TREE_OPERAND (ass, 1) = def; update_stmt (ass); } diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 7e1363e9aef..4925d452726 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -5695,14 +5695,15 @@ compute_phi_arg_on_exit (edge exit, tree stmts, tree op) { for (tsi = tsi_start (stmts); !tsi_end_p (tsi); tsi_next (&tsi)) { - bsi_insert_after (&bsi, tsi_stmt (tsi), BSI_NEW_STMT); - protect_loop_closed_ssa_form (exit, bsi_stmt (bsi)); + tree stmt = tsi_stmt (tsi); + bsi_insert_before (&bsi, stmt, BSI_SAME_STMT); + protect_loop_closed_ssa_form (exit, stmt); } } else { - bsi_insert_after (&bsi, stmts, BSI_NEW_STMT); - protect_loop_closed_ssa_form (exit, bsi_stmt (bsi)); + bsi_insert_before (&bsi, stmts, BSI_SAME_STMT); + protect_loop_closed_ssa_form (exit, stmts); } if (!op) @@ -5719,7 +5720,7 @@ compute_phi_arg_on_exit (edge exit, tree stmts, tree op) stmt = build2 (MODIFY_EXPR, TREE_TYPE (op), def, op); SSA_NAME_DEF_STMT (def) = stmt; - bsi_insert_after (&bsi, stmt, BSI_CONTINUE_LINKING); + bsi_insert_before (&bsi, stmt, BSI_SAME_STMT); } } } -- 2.11.0