SuccessChanges

Summary

  1. [SimplifyCFGPass] Ensure that DominatorTreeWrapperPass is init'd before SimplifyCFG (details)
  2. [SimplifyCFG] Teach tryWidenCondBranchToCondBranch() to preserve DomTree (details)
  3. [SimplifyCFG] Teach eliminateDeadSwitchCases() to preserve DomTree, part 2 (details)
  4. [IR] PassManagerTest: Register DominatorTreeAnalysis before running SimplifyCFGPass (details)
  5. [Utils] LocalTest: fix SimplifyCFGWithNullAC test to work with `-simplifycfg-require-and-preserve-domtree=1` (details)
  6. [NFC] clang-format the entire DwarfEHPrepare.cpp (details)
  7. [NFC][CodeGen] Split DwarfEHPrepare pass into an actual transform and an legacy-PM wrapper (details)
  8. [NFC][CodeGen][Tests] Mark all tests that fail to preserve DomTree for SimplifyCFG as such (details)
  9. [CodeGen][SimplifyCFG] Teach DwarfEHPrepare to preserve DomTree (details)
  10. [SimplifyCFG] Teach removeUndefIntroducingPredecessor to preserve DomTree (details)
  11. [AMDGPU][SimplifyCFG] Teach AMDGPUUnifyDivergentExitNodes to preserve {,Post}DomTree (details)
Commit e08fea3b240994572a4dd6b34bd846aef023a123 by lebedev.ri
[SimplifyCFGPass] Ensure that DominatorTreeWrapperPass is init'd before SimplifyCFG

It's probably better than hoping that it will happen to be
already initialized.
The file was modifiedllvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
Commit f1ce6960561bc28129fa3306f57a5c6df21258ab by lebedev.ri
[SimplifyCFG] Teach tryWidenCondBranchToCondBranch() to preserve DomTree
The file was modifiedllvm/test/Transforms/SimplifyCFG/wc-widen-block.ll
The file was modifiedllvm/lib/Transforms/Utils/SimplifyCFG.cpp
Commit 657c1e09da9fb5e63b963fe8eeace01e42e7d3ba by lebedev.ri
[SimplifyCFG] Teach eliminateDeadSwitchCases() to preserve DomTree, part 2
The file was modifiedllvm/lib/Transforms/Utils/SimplifyCFG.cpp
The file was modifiedllvm/test/Transforms/SimplifyCFG/switch-dead-default.ll
Commit db753269d912936d9ab27018faf867afce4b16de by lebedev.ri
[IR] PassManagerTest: Register DominatorTreeAnalysis before running SimplifyCFGPass

Otherwise these particular tests fail when SimplifyCFG requires DomTree
The file was modifiedllvm/unittests/IR/PassManagerTest.cpp
Commit 5fe0798dee6e2093aad7be11956c2bcaaf61dc8c by lebedev.ri
[Utils] LocalTest: fix SimplifyCFGWithNullAC test to work with `-simplifycfg-require-and-preserve-domtree=1`
The file was modifiedllvm/unittests/Transforms/Utils/LocalTest.cpp
Commit c38739ad8f10beb3144abcfebdcf50547328d346 by lebedev.ri
[NFC] clang-format the entire DwarfEHPrepare.cpp
The file was modifiedllvm/lib/CodeGen/DwarfEHPrepare.cpp
Commit e6b1a27fb9c71a9a81439917368a25ddc7d371a9 by lebedev.ri
[NFC][CodeGen] Split DwarfEHPrepare pass into an actual transform and an legacy-PM wrapper

This is consistent with the layout of other passes,
and simplifies further refinements regarding DomTree handling.

This is indended to be a NFC commit.
The file was modifiedllvm/include/llvm/InitializePasses.h
The file was modifiedllvm/tools/opt/opt.cpp
The file was modifiedllvm/lib/CodeGen/DwarfEHPrepare.cpp
The file was modifiedllvm/lib/CodeGen/CodeGen.cpp
Commit b23b1bcc26e775a4998a78b6fe256e8cb0e3e0d3 by lebedev.ri
[NFC][CodeGen][Tests] Mark all tests that fail to preserve DomTree for SimplifyCFG as such

These tests start to fail when the SimplifyCFG's default regarding DomTree
updating is switched on, so mark them as needing changes.
The file was modifiedllvm/test/CodeGen/AMDGPU/wave32.ll
The file was modifiedllvm/test/CodeGen/SPARC/exception.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/branch-relaxation.ll
The file was modifiedllvm/test/CodeGen/PowerPC/aix-exception.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/unigine-liveness-crash.ll
The file was modifiedllvm/test/CodeGen/Hexagon/cfi_offset.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/ret_jump.ll
The file was modifiedllvm/test/CodeGen/Hexagon/misaligned_double_vector_store_not_fast.ll
The file was modifiedllvm/test/CodeGen/ARM/ehabi-filters.ll
The file was modifiedllvm/test/CodeGen/Hexagon/swp-epilog-phi10.ll
The file was modifiedllvm/test/CodeGen/X86/2012-01-10-UndefExceptionEdge.ll
The file was modifiedllvm/test/CodeGen/X86/basic-block-sections-eh.ll
The file was modifiedllvm/test/CodeGen/X86/code-model-kernel.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/multi-divergent-exit-region.ll
The file was modifiedllvm/test/CodeGen/ARM/global-merge.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/si-annotate-cf-noloop.ll
The file was modifiedllvm/test/CodeGen/Hexagon/swp-reuse-phi-4.ll
The file was modifiedllvm/test/CodeGen/Thumb2/2009-08-04-CoalescerBug.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/si-lower-control-flow-unreachable-block.ll
The file was modifiedllvm/test/CodeGen/PowerPC/2007-11-16-landingpad-split.ll
The file was modifiedllvm/test/CodeGen/X86/gcc_except_table-multi.ll
The file was modifiedllvm/test/CodeGen/ARM/2014-05-14-DwarfEHCrash.ll
The file was modifiedllvm/test/CodeGen/X86/2007-05-05-Personality.ll
The file was modifiedllvm/test/CodeGen/ARM/arm-ttype-target2.ll
The file was modifiedllvm/test/CodeGen/AArch64/pic-eh-stubs.ll
The file was modifiedllvm/test/CodeGen/ARM/dwarf-eh.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/skip-if-dead.ll
The file was modifiedllvm/test/CodeGen/ARM/2011-05-04-MultipleLandingPadSuccs.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/mixed-wave32-wave64.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/atomic_optimizations_pixelshader.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/valu-i1.ll
The file was modifiedllvm/test/CodeGen/X86/2010-08-04-MingWCrash.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/unstructured-cfg-def-use-issue.ll
The file was modifiedllvm/test/CodeGen/X86/dwarf-eh-prepare.ll
The file was modifiedllvm/test/CodeGen/X86/indirect-branch-tracking-eh2.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/kill-infinite-loop.ll
The file was modifiedllvm/test/CodeGen/Hexagon/ehabi.ll
The file was modifiedllvm/test/CodeGen/ARM/setjmp_longjmp.ll
The file was modifiedllvm/test/CodeGen/Hexagon/packetize-allocframe.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/update-phi.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/infinite-loop.ll
The file was modifiedllvm/test/CodeGen/Hexagon/swp-order-deps3.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/branch-condition-and.ll
Commit 2461cdb41724298591133c811df82b0064adfa6b by lebedev.ri
[CodeGen][SimplifyCFG] Teach DwarfEHPrepare to preserve DomTree

Once the default for SimplifyCFG flips, we can no longer pass nullptr
instead of DomTree to SimplifyCFG, so we need to propagate it here.

We don't strictly need to actually preserve DomTree in DwarfEHPrepare,
but we might as well do it, since it's trivial.
The file was modifiedllvm/test/CodeGen/Hexagon/cfi_offset.ll
The file was modifiedllvm/test/CodeGen/X86/gcc_except_table-multi.ll
The file was modifiedllvm/test/CodeGen/ARM/dwarf-eh.ll
The file was modifiedllvm/lib/CodeGen/DwarfEHPrepare.cpp
The file was modifiedllvm/test/CodeGen/ARM/setjmp_longjmp.ll
The file was modifiedllvm/test/CodeGen/X86/2007-05-05-Personality.ll
The file was modifiedllvm/test/CodeGen/ARM/2011-05-04-MultipleLandingPadSuccs.ll
The file was modifiedllvm/test/CodeGen/ARM/arm-ttype-target2.ll
The file was modifiedllvm/test/CodeGen/X86/indirect-branch-tracking-eh2.ll
The file was modifiedllvm/test/CodeGen/PowerPC/2007-11-16-landingpad-split.ll
The file was modifiedllvm/test/CodeGen/SPARC/exception.ll
The file was modifiedllvm/test/CodeGen/X86/2012-01-10-UndefExceptionEdge.ll
The file was modifiedllvm/test/CodeGen/AArch64/pic-eh-stubs.ll
The file was modifiedllvm/test/CodeGen/ARM/2014-05-14-DwarfEHCrash.ll
The file was modifiedllvm/test/CodeGen/X86/code-model-kernel.ll
The file was modifiedllvm/test/CodeGen/ARM/ehabi-filters.ll
The file was modifiedllvm/test/CodeGen/X86/2010-08-04-MingWCrash.ll
The file was modifiedllvm/test/CodeGen/ARM/global-merge.ll
The file was modifiedllvm/test/CodeGen/Hexagon/ehabi.ll
The file was modifiedllvm/test/CodeGen/Hexagon/packetize-allocframe.ll
The file was modifiedllvm/test/CodeGen/X86/basic-block-sections-eh.ll
The file was modifiedllvm/test/CodeGen/X86/dwarf-eh-prepare.ll
The file was modifiedllvm/test/CodeGen/PowerPC/aix-exception.ll
Commit b4429f3cdd1a8511bd014877b22d9679c4a74dbd by lebedev.ri
[SimplifyCFG] Teach removeUndefIntroducingPredecessor to preserve DomTree
The file was modifiedllvm/test/CodeGen/Hexagon/swp-reuse-phi-4.ll
The file was modifiedllvm/test/CodeGen/Thumb2/2009-08-04-CoalescerBug.ll
The file was modifiedllvm/test/CodeGen/Hexagon/swp-epilog-phi10.ll
The file was modifiedllvm/test/CodeGen/Hexagon/swp-order-deps3.ll
The file was modifiedllvm/lib/Transforms/Utils/SimplifyCFG.cpp
The file was modifiedllvm/test/CodeGen/Hexagon/misaligned_double_vector_store_not_fast.ll
Commit 4b80647367950ba3da6a08260487fd0dbc50a9c5 by lebedev.ri
[AMDGPU][SimplifyCFG] Teach AMDGPUUnifyDivergentExitNodes to preserve {,Post}DomTree

This is a (last big?) part of the patch series to make SimplifyCFG
preserve DomTree. Currently, it still does not actually preserve it,
even thought it is pretty much fully updated to preserve it.

Once the default is flipped, a valid DomTree must be passed into
simplifyCFG, which means that whatever pass calls simplifyCFG,
should also be smart about DomTree's.

As far as i can see from `check-llvm` with default flipped,
this is the last LLVM test batch (other than bugpoint tests)
that needed fixes to not break with default flipped.

The changes here are boringly identical to the ones i did
over 42+ times/commits recently already,
so while AMDGPU is outside of my normal ecosystem,
i'm going to go for post-commit review here,
like in all the other 42+ changes.

Note that while the pass is taught to preserve {,Post}DomTree,
it still doesn't do that by default, because simplifycfg
still doesn't do that by default, and flipping default
in this pass will implicitly flip the default for simplifycfg.
That will happen, but not right now.
The file was modifiedllvm/test/CodeGen/AMDGPU/branch-condition-and.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/update-phi.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/infinite-loop.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/kill-infinite-loop.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/si-lower-control-flow-unreachable-block.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/atomic_optimizations_pixelshader.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/branch-relaxation.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/ret_jump.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/valu-i1.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/si-annotate-cf-noloop.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/mixed-wave32-wave64.ll
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp
The file was modifiedllvm/test/CodeGen/AMDGPU/wave32.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/skip-if-dead.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/unstructured-cfg-def-use-issue.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/unigine-liveness-crash.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/multi-divergent-exit-region.ll