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. Richard. 2014-06-13 Richard Biener <rguent...@suse.de> * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children): Make all defs available at the end. * passes.def (pass_all_early_optimizations): Remove copy-prop pass. (pass_all_optimizations): Move 3rd copy-prop pass from after fre to before ifcombine/phiopt. Index: gcc/tree-ssa-pre.c =================================================================== *** gcc/tree-ssa-pre.c (revision 211625) --- gcc/tree-ssa-pre.c (working copy) *************** eliminate_dom_walker::before_dom_childre *** 4188,4194 **** b->loop_father->num); } /* Don't keep sprime available. */ - eliminate_push_avail (lhs); sprime = NULL_TREE; } } --- 4188,4193 ---- *************** eliminate_dom_walker::before_dom_childre *** 4433,4442 **** 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); } /* Replace destination PHI arguments. */ --- 4432,4442 ---- VN_INFO (vdef)->valnum = vuse; } ! /* 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. */ Index: gcc/passes.def =================================================================== *** gcc/passes.def (revision 211625) --- gcc/passes.def (working copy) *************** along with GCC; see the file COPYING3. *** 73,79 **** execute TODO_rebuild_alias at this point. */ NEXT_PASS (pass_build_ealias); NEXT_PASS (pass_fre); - NEXT_PASS (pass_copy_prop); NEXT_PASS (pass_merge_phi); NEXT_PASS (pass_cd_dce); NEXT_PASS (pass_early_ipa_sra); --- 73,78 ---- *************** along with GCC; see the file COPYING3. *** 149,160 **** NEXT_PASS (pass_build_alias); NEXT_PASS (pass_return_slot); NEXT_PASS (pass_fre); - NEXT_PASS (pass_copy_prop); NEXT_PASS (pass_merge_phi); NEXT_PASS (pass_vrp); NEXT_PASS (pass_dce); NEXT_PASS (pass_call_cdce); NEXT_PASS (pass_cselim); NEXT_PASS (pass_tree_ifcombine); NEXT_PASS (pass_phiopt); NEXT_PASS (pass_tail_recursion); --- 148,159 ---- NEXT_PASS (pass_build_alias); NEXT_PASS (pass_return_slot); NEXT_PASS (pass_fre); NEXT_PASS (pass_merge_phi); NEXT_PASS (pass_vrp); NEXT_PASS (pass_dce); NEXT_PASS (pass_call_cdce); NEXT_PASS (pass_cselim); + NEXT_PASS (pass_copy_prop); NEXT_PASS (pass_tree_ifcombine); NEXT_PASS (pass_phiopt); NEXT_PASS (pass_tail_recursion);