diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2009-09-08 17:40:45 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2009-09-08 17:40:45 +0000 |
commit | ae0a44495fa7e8ef142c4ae1f98608238d40a5dc (patch) | |
tree | 6f46f4c8824e9ae9b60929059979e43fed8167dd /gcc/tree-ssa.c | |
parent | 21719cea1138d7e095c0ba68402175550e62f5e1 (diff) | |
download | gcc-ae0a44495fa7e8ef142c4ae1f98608238d40a5dc.zip gcc-ae0a44495fa7e8ef142c4ae1f98608238d40a5dc.tar.gz gcc-ae0a44495fa7e8ef142c4ae1f98608238d40a5dc.tar.bz2 |
tree-ssa-loop-ivopts.c (get_phi_with_result): Remove.
* tree-ssa-loop-ivopts.c (get_phi_with_result): Remove.
(remove_statement): Likewise.
(rewrite_use_nonlinear_expr): Adjust.
(remove_unused_ivs): Collect SSA NAMEs to remove and call...
* tree-ssa.c (release_defs_bitset): ... this. New.
* tree-flow.h (release_defs_bitset): Declare.
From-SVN: r151520
Diffstat (limited to 'gcc/tree-ssa.c')
-rw-r--r-- | gcc/tree-ssa.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 0ff4733..b5b6afe 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -444,6 +444,74 @@ propagate_defs_into_debug_stmts (gimple def, basic_block tobb, } } +/* Delete SSA DEFs for SSA versions in the TOREMOVE bitmap, removing + dominated stmts before their dominators, so that release_ssa_defs + stands a chance of propagating DEFs into debug bind stmts. */ + +void +release_defs_bitset (bitmap toremove) +{ + unsigned j; + bitmap_iterator bi; + + /* Performing a topological sort is probably overkill, this will + 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; + + /* 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 (!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 (gimple_code (def) == GIMPLE_PHI) + remove_phi_node (&gsi, true); + else + { + gsi_remove (&gsi, true); + release_defs (def); + } + + bitmap_clear_bit (toremove, j); + } + } +} + /* Return true if SSA_NAME is malformed and mark it visited. IS_VIRTUAL is true if this SSA_NAME was found inside a virtual |