This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Make bsi_after_labels return a BSI pointing after the labels (4.1 too?)
- From: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>
- To: Andrew Pinski <pinskia at physics dot uc dot edu>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Diego Novillo <dnovillo at redhat dot com>
- Date: Thu, 02 Feb 2006 13:33:45 +0100
- Subject: Re: [PATCH] Make bsi_after_labels return a BSI pointing after the labels (4.1 too?)
- References: <43E1C968.8080104@lu.unisi.ch> <409b61882ce124c7342dea0f786b7b28@physics.uc.edu>
Andrew Pinski wrote:
On Feb 2, 2006, at 3:57 AM, Paolo Bonzini wrote:
Bootstrapped/regtested i686-pc-linux-gnu, all languages. Ok for
mainline, and maybe for 4.1 after a week or less?
I think you forgot to attach the patch.
Yes, I did. Thanks for noticing.
Paolo
2006-02-02 Paolo Bonzini <bonzini@gnu.org>
* 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.
Index: lambda-code.c
===================================================================
--- lambda-code.c (revision 110248)
+++ lambda-code.c (working copy)
@@ -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);
}
Index: tree-flow-inline.h
===================================================================
--- tree-flow-inline.h (revision 110248)
+++ tree-flow-inline.h (working copy)
@@ -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;
}
Index: tree-if-conv.c
===================================================================
--- tree-if-conv.c (revision 110248)
+++ tree-if-conv.c (working copy)
@@ -737,8 +737,7 @@ find_phi_replacement_condition (struct l
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
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))
Index: tree-scalar-evolution.c
===================================================================
--- tree-scalar-evolution.c (revision 110248)
+++ tree-scalar-evolution.c (working copy)
@@ -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);
}
Index: tree-ssa-loop-ivopts.c
===================================================================
--- tree-ssa-loop-ivopts.c (revision 110248)
+++ tree-ssa-loop-ivopts.c (working copy)
@@ -5696,14 +5696,15 @@ compute_phi_arg_on_exit (edge exit, tree
{
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)
@@ -5720,7 +5721,7 @@ compute_phi_arg_on_exit (edge exit, tree
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);
}
}
}