aboutsummaryrefslogtreecommitdiff
path: root/gcc/lambda-code.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/lambda-code.c')
-rw-r--r--gcc/lambda-code.c64
1 files changed, 30 insertions, 34 deletions
diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c
index bf00c05..3a28ee3 100644
--- a/gcc/lambda-code.c
+++ b/gcc/lambda-code.c
@@ -1923,9 +1923,10 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
for (i = 0; VEC_iterate (tree, old_ivs, i, oldiv); i++)
{
imm_use_iterator imm_iter;
- use_operand_p imm_use;
+ use_operand_p use_p;
tree oldiv_def;
tree oldiv_stmt = SSA_NAME_DEF_STMT (oldiv);
+ tree stmt;
if (TREE_CODE (oldiv_stmt) == PHI_NODE)
oldiv_def = PHI_RESULT (oldiv_stmt);
@@ -1933,37 +1934,31 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
oldiv_def = SINGLE_SSA_TREE_OPERAND (oldiv_stmt, SSA_OP_DEF);
gcc_assert (oldiv_def != NULL_TREE);
- FOR_EACH_IMM_USE_SAFE (imm_use, imm_iter, oldiv_def)
- {
- tree stmt = USE_STMT (imm_use);
- use_operand_p use_p;
- ssa_op_iter iter;
+ FOR_EACH_IMM_USE_STMT (stmt, imm_iter, oldiv_def)
+ {
+ tree newiv, stmts;
+ lambda_body_vector lbv, newlbv;
+
gcc_assert (TREE_CODE (stmt) != PHI_NODE);
- FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE)
- {
- if (USE_FROM_PTR (use_p) == oldiv)
- {
- tree newiv, stmts;
- lambda_body_vector lbv, newlbv;
- /* Compute the new expression for the induction
- variable. */
- depth = VEC_length (tree, new_ivs);
- lbv = lambda_body_vector_new (depth);
- LBV_COEFFICIENTS (lbv)[i] = 1;
-
- newlbv = lambda_body_vector_compute_new (transform, lbv);
-
- newiv = lbv_to_gcc_expression (newlbv, TREE_TYPE (oldiv),
- new_ivs, &stmts);
- bsi = bsi_for_stmt (stmt);
- /* Insert the statements to build that
- expression. */
- bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
- propagate_value (use_p, newiv);
- update_stmt (stmt);
-
- }
- }
+
+ /* Compute the new expression for the induction
+ variable. */
+ depth = VEC_length (tree, new_ivs);
+ lbv = lambda_body_vector_new (depth);
+ LBV_COEFFICIENTS (lbv)[i] = 1;
+
+ newlbv = lambda_body_vector_compute_new (transform, lbv);
+
+ newiv = lbv_to_gcc_expression (newlbv, TREE_TYPE (oldiv),
+ new_ivs, &stmts);
+ bsi = bsi_for_stmt (stmt);
+ /* Insert the statements to build that
+ expression. */
+ bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
+
+ FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter)
+ propagate_value (use_p, newiv);
+ update_stmt (stmt);
}
}
VEC_free (tree, heap, new_ivs);
@@ -2482,6 +2477,7 @@ perfect_nestify (struct loops *loops,
{
use_operand_p use_p;
imm_use_iterator imm_iter;
+ tree imm_stmt;
tree stmt = bsi_stmt (bsi);
if (stmt == exit_condition
@@ -2495,10 +2491,9 @@ perfect_nestify (struct loops *loops,
/* Make copies of this statement to put it back next
to its uses. */
- FOR_EACH_IMM_USE_SAFE (use_p, imm_iter,
+ FOR_EACH_IMM_USE_STMT (imm_stmt, imm_iter,
TREE_OPERAND (stmt, 0))
{
- tree imm_stmt = USE_STMT (use_p);
if (!exit_phi_for_loop_p (loop->inner, imm_stmt))
{
block_stmt_iterator tobsi;
@@ -2511,7 +2506,8 @@ perfect_nestify (struct loops *loops,
newname = SSA_NAME_VAR (newname);
newname = make_ssa_name (newname, newstmt);
TREE_OPERAND (newstmt, 0) = newname;
- SET_USE (use_p, TREE_OPERAND (newstmt, 0));
+ FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter)
+ SET_USE (use_p, newname);
bsi_insert_before (&tobsi, newstmt, BSI_SAME_STMT);
update_stmt (newstmt);
update_stmt (imm_stmt);