This moves most of mergephi functionality to cfgcleanup. The only thing
mergephi does that is not done in cfgcleanup is the ability to split edges in
some cases.
This includes many cleanups to the code that were missing over the years.
Including removing the worklist from mergephi which was never needed in the
first place (but was done as a mirror of what was done in cfgcleanup at the
time). Also merges (finally) remove_forwarder_block_with_phi functionality
into remove_forwarder_block; the patch set makes that easier by doing very
similar things in both.

Also fixes a few issues with remove_forwarder_block_with_phi that were missing
before; one was a location fix; another is protection of preheader of loops
(see patch 11 for that one). Also one dealing with merging of bb vs removal
of forwarder blocks; the merge code has better support for profiling data.

Note I don't merge tree_forwarder_block_p and remove_forwarder_block even
though they are now called right after eachother in cfgcleanup and mergephi now.
That is for another day.

Andrew Pinski (12):
  mergephi: Remove worklist
  cfglceanup: Remove check for infinite loop in
    remove_forwarder_block/remove_forwarder_block_with_phi
  cfgcleanup: Move check for dest containing non-local label/eh landing
    pad to tree_forwarder_block_p
  mergephi: Move checks from pass_merge_phi::execute to
    remove_forwarder_block_with_phi
  cfgcleanup: forwarder block, ignore bbs which merge with the
    predecessor
  cfgcleanup: Remove check on available dominator information in
    remove_forwarder_block
  mergephi: use edge iterator in remove_forwarder_block_with_phi
  cfgcleanup: Move ei definition into for loop for
    remove_forwarder_block
  mergephi: extend copy_phi_arg_into_existing_phi and use it for
    remove_forwarder_block_with_phi
  fix handling of mapped and their location
  cfgcleanup: Support merging forwarder blocks with phis [PR122493]
  Merge remove_forwarder_block_with_phi into remove_forwarder_block

 gcc/testsuite/g++.dg/uninit-pred-5.C          |   2 +-
 .../gcc.dg/tree-ssa/ssa-dom-thread-7.c        |   4 +-
 gcc/testsuite/gcc.dg/uninit-pred-7_a.c        |   2 +-
 gcc/testsuite/gcc.target/i386/pr121062-1.c    |   2 +-
 gcc/tree-cfg.cc                               |  33 +-
 gcc/tree-cfg.h                                |   2 +-
 gcc/tree-cfgcleanup.cc                        | 389 ++++++------------
 7 files changed, 157 insertions(+), 277 deletions(-)

-- 
2.43.0

Reply via email to