aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-ssa.c')
-rw-r--r--gcc/tree-ssa.c102
1 files changed, 57 insertions, 45 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index d442a5f..261d9b0 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -551,58 +551,70 @@ release_defs_bitset (bitmap toremove)
most likely run in slightly superlinear time, rather than the
pathological quadratic worst case. */
while (!bitmap_empty_p (toremove))
- EXECUTE_IF_SET_IN_BITMAP (toremove, 0, j, bi)
- {
- bool remove_now = true;
- tree var = ssa_name (j);
- gimple *stmt;
- imm_use_iterator uit;
-
- FOR_EACH_IMM_USE_STMT (stmt, uit, var)
- {
- ssa_op_iter dit;
- def_operand_p def_p;
+ {
+ unsigned to_remove_bit = -1U;
+ EXECUTE_IF_SET_IN_BITMAP (toremove, 0, j, bi)
+ {
+ if (to_remove_bit != -1U)
+ {
+ bitmap_clear_bit (toremove, to_remove_bit);
+ to_remove_bit = -1U;
+ }
- /* We can't propagate PHI nodes into debug stmts. */
- if (gimple_code (stmt) == GIMPLE_PHI
- || is_gimple_debug (stmt))
- continue;
+ bool remove_now = true;
+ tree var = ssa_name (j);
+ gimple *stmt;
+ imm_use_iterator uit;
- /* If we find another definition to remove that uses
- the one we're looking at, defer the removal of this
- one, so that it can be propagated into debug stmts
- after the other is. */
- FOR_EACH_SSA_DEF_OPERAND (def_p, stmt, dit, SSA_OP_DEF)
- {
- tree odef = DEF_FROM_PTR (def_p);
+ FOR_EACH_IMM_USE_STMT (stmt, uit, var)
+ {
+ ssa_op_iter dit;
+ def_operand_p def_p;
+
+ /* We can't propagate PHI nodes into debug stmts. */
+ if (gimple_code (stmt) == GIMPLE_PHI
+ || is_gimple_debug (stmt))
+ continue;
+
+ /* If we find another definition to remove that uses
+ the one we're looking at, defer the removal of this
+ one, so that it can be propagated into debug stmts
+ after the other is. */
+ FOR_EACH_SSA_DEF_OPERAND (def_p, stmt, dit, SSA_OP_DEF)
+ {
+ tree odef = DEF_FROM_PTR (def_p);
- if (bitmap_bit_p (toremove, SSA_NAME_VERSION (odef)))
- {
- remove_now = false;
- break;
- }
- }
+ if (bitmap_bit_p (toremove, SSA_NAME_VERSION (odef)))
+ {
+ remove_now = false;
+ break;
+ }
+ }
- if (!remove_now)
- BREAK_FROM_IMM_USE_STMT (uit);
- }
+ if (!remove_now)
+ BREAK_FROM_IMM_USE_STMT (uit);
+ }
- if (remove_now)
- {
- gimple *def = SSA_NAME_DEF_STMT (var);
- gimple_stmt_iterator gsi = gsi_for_stmt (def);
+ if (remove_now)
+ {
+ gimple *def = SSA_NAME_DEF_STMT (var);
+ gimple_stmt_iterator gsi = gsi_for_stmt (def);
- if (gimple_code (def) == GIMPLE_PHI)
- remove_phi_node (&gsi, true);
- else
- {
- gsi_remove (&gsi, true);
- release_defs (def);
- }
+ if (gimple_code (def) == GIMPLE_PHI)
+ remove_phi_node (&gsi, true);
+ else
+ {
+ gsi_remove (&gsi, true);
+ release_defs (def);
+ }
+
+ to_remove_bit = j;
+ }
+ }
+ if (to_remove_bit != -1U)
+ bitmap_clear_bit (toremove, to_remove_bit);
+ }
- bitmap_clear_bit (toremove, j);
- }
- }
}
/* Verify virtual SSA form. */