[PATCH] Remove / move copy-prop passes
Richard Biener
rguenther@suse.de
Mon Jun 16 08:14:00 GMT 2014
On Fri, 13 Jun 2014, Richard Biener wrote:
>
> The following leverages the "extra" work done by FRE/PRE now
> (propagating copies and constants) and removes the copy-prop
> pass run during early optimizations (no passes after it expose
> copy propagation opportunities). It also moves the 3rd
> copy-prop pass from right after FRE (where it is now pointless)
> to right before ifcombine and phiopt as both benefit from
> copy-propagated IL (as we saw from the last phiopt bug).
>
> I tested the copyprop removal from early opts with an
> assertion that we don't compute useful lattice values
> in the first pass instance (only for dead stmts). For this
> the slight adjustment to the PRE/FRE elimination is necessary
> to also catch copy propagation opportunities from ASM outputs.
>
> Bootstrap / regtest pending on x86_64-unknown-linux-gnu.
Ok, so this exposes some missing poor-mans DCE in the testsuite so
I went ahead and applied the following adjusted PRE adjustments only
sofar (I have a patch addressing the rest but will delay the actual
pass pipeline adjustments until later).
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
2014-06-16 Richard Biener <rguenther@suse.de>
* tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
Make all defs available at the end.
(eliminate): If we remove a PHI node schedule cfg-cleanup.
Index: gcc/tree-ssa-pre.c
===================================================================
--- gcc/tree-ssa-pre.c (revision 211694)
+++ gcc/tree-ssa-pre.c (working copy)
@@ -4188,7 +4188,6 @@ eliminate_dom_walker::before_dom_childre
b->loop_father->num);
}
/* Don't keep sprime available. */
- eliminate_push_avail (lhs);
sprime = NULL_TREE;
}
}
@@ -4433,10 +4432,11 @@ eliminate_dom_walker::before_dom_childre
VN_INFO (vdef)->valnum = vuse;
}
- /* Make the new value available - for fully redundant LHS we
- continue with the next stmt above. */
- if (lhs && TREE_CODE (lhs) == SSA_NAME)
- eliminate_push_avail (lhs);
+ /* Make new values available - for fully redundant LHS we
+ continue with the next stmt above and skip this. */
+ def_operand_p defp;
+ FOR_EACH_SSA_DEF_OPERAND (defp, stmt, iter, SSA_OP_DEF)
+ eliminate_push_avail (DEF_FROM_PTR (defp));
}
/* Replace destination PHI arguments. */
@@ -4521,7 +4521,11 @@ eliminate (bool do_pre)
gsi = gsi_for_stmt (stmt);
if (gimple_code (stmt) == GIMPLE_PHI)
- remove_phi_node (&gsi, true);
+ {
+ remove_phi_node (&gsi, true);
+ /* Removing a PHI node in a block may expose a forwarder block. */
+ el_todo |= TODO_cleanup_cfg;
+ }
else
{
basic_block bb = gimple_bb (stmt);
More information about the Gcc-patches
mailing list