aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-im.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-ssa-loop-im.c')
-rw-r--r--gcc/tree-ssa-loop-im.c49
1 files changed, 30 insertions, 19 deletions
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 27bc1c01d95..068a7d6b0bf 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -929,12 +929,13 @@ single_reachable_address (struct loop *loop, tree stmt,
tree *queue = xmalloc (sizeof (tree) * max_uid);
sbitmap seen = sbitmap_alloc (max_uid);
unsigned in_queue = 1;
- dataflow_t df;
- unsigned i, n;
+ unsigned i;
struct sra_data sra_data;
tree call;
tree val;
ssa_op_iter iter;
+ imm_use_iterator imm_iter;
+ use_operand_p use_p;
sbitmap_zero (seen);
@@ -992,22 +993,35 @@ single_reachable_address (struct loop *loop, tree stmt,
}
/* Find uses of virtual names. */
- df = get_immediate_uses (stmt);
- n = num_immediate_uses (df);
+ if (TREE_CODE (stmt) == PHI_NODE)
+ FOR_EACH_IMM_USE_FAST (use_p, imm_iter, PHI_RESULT (stmt))
+ {
+ tree imm_stmt = USE_STMT (use_p);
+
+ if (!flow_bb_inside_loop_p (loop, bb_for_stmt (imm_stmt)))
+ continue;
+
+ if (TEST_BIT (seen, get_stmt_uid (imm_stmt)))
+ continue;
+ SET_BIT (seen, get_stmt_uid (imm_stmt));
+
+ queue[in_queue++] = imm_stmt;
+ }
+ else
+ FOR_EACH_SSA_TREE_OPERAND (val, stmt, iter, SSA_OP_VIRTUAL_DEFS)
+ FOR_EACH_IMM_USE_FAST (use_p, imm_iter, val)
+ {
+ tree imm_stmt = USE_STMT (use_p);
- for (i = 0; i < n; i++)
- {
- stmt = immediate_use (df, i);
+ if (!flow_bb_inside_loop_p (loop, bb_for_stmt (imm_stmt)))
+ continue;
- if (!flow_bb_inside_loop_p (loop, bb_for_stmt (stmt)))
- continue;
+ if (TEST_BIT (seen, get_stmt_uid (imm_stmt)))
+ continue;
+ SET_BIT (seen, get_stmt_uid (imm_stmt));
- if (TEST_BIT (seen, get_stmt_uid (stmt)))
- continue;
- SET_BIT (seen, get_stmt_uid (stmt));
-
- queue[in_queue++] = stmt;
- }
+ queue[in_queue++] = imm_stmt;
+ }
}
free (queue);
@@ -1042,7 +1056,7 @@ rewrite_mem_refs (tree tmp_var, struct mem_ref *mem_refs)
}
*mem_refs->ref = tmp_var;
- modify_stmt (mem_refs->stmt);
+ update_stmt (mem_refs->stmt);
}
}
@@ -1266,8 +1280,6 @@ determine_lsm (struct loops *loops)
stmt_ann (bsi_stmt (bsi))->uid = max_stmt_uid++;
}
- compute_immediate_uses (TDFA_USE_VOPS, NULL);
-
/* Pass the loops from the outermost. For each virtual operand loop phi node
check whether all the references inside the loop correspond to a single
address, and if so, move them. */
@@ -1287,7 +1299,6 @@ determine_lsm (struct loops *loops)
loop = loop->outer;
if (loop == loops->tree_root)
{
- free_df ();
loop_commit_inserts ();
return;
}