aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2016-10-07 10:06:24 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2016-10-07 10:06:24 +0000
commita30fe4b68120118221578b111036fa5fea0d25b3 (patch)
treeb23b27954b915b8b7d050e18c30416a85b78a564 /gcc/tree-ssa.c
parenta93cdc5c6f1d56226c3ef7b69423a4074783de34 (diff)
downloadgcc-a30fe4b68120118221578b111036fa5fea0d25b3.zip
gcc-a30fe4b68120118221578b111036fa5fea0d25b3.tar.gz
gcc-a30fe4b68120118221578b111036fa5fea0d25b3.tar.bz2
bitmap.c (bitmap_elem_to_freelist): Set indx to -1.
2016-10-07 Richard Biener <rguenther@suse.de> * bitmap.c (bitmap_elem_to_freelist): Set indx to -1. * bitmap.h (bmp_iter_set): When advancing to the next element check that we didn't remove the current one. (bmp_iter_and): Likewise. (bmp_iter_and_compl): Likewise. * tree-ssa.c (release_defs_bitset): Do not remove worklist bit we currently iterate on but keep a one-level queue. * sched-deps.c (remove_from_deps): Do not clear current bit but keep a one-level queue. From-SVN: r240859
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. */