SuccessChanges

Summary

  1. [NFCI][SimlifyCFG] simplifyOnce(): also perform DomTree validation (details)
  2. [SimplifyCFG] Teach FoldTwoEntryPHINode() to preserve DomTree (details)
  3. [SimplifyCFG] Teach removeEmptyCleanup() to preserve DomTree (details)
  4. [SimplifyCFG] Teach simplifyCommonResume() to preserve DomTree (details)
  5. [SimplifyCFG] Teach simplifySingleResume() to preserve DomTree (details)
  6. [SimplifyCFG] simplifySingleResume(): FoldReturnIntoUncondBranch() already knows how to preserve DomTree (details)
  7. [NFCI][SimplifyCFG] SimplifyCondBranchToTwoReturns(): pull out BI->getParent() into a variable (details)
  8. [SimplifyCFG] Teach SimplifyCondBranchToTwoReturns() to preserve DomTree, part 1 (details)
  9. [SimplifyCFG] Teach SimplifyCondBranchToTwoReturns() to preserve DomTree, part 2 (details)
  10. [SimplifyCFG] Teach TryToMergeLandingPad() to preserve DomTree (details)
  11. [SimplifyCFG] Teach FoldBranchToCommonDest() to preserve DomTree, part 1 (details)
Commit b43b77ff9b82d53321e401cf1ededdaf30fff407 by lebedev.ri
[NFCI][SimlifyCFG] simplifyOnce(): also perform DomTree validation

And that exposes that a number of tests don't *actually* manage to
maintain DomTree validity, which is inline with my observations.

Once again, SimlifyCFG pass currently does not require/preserve DomTree
by default, so this is effectively NFC.
The file was modifiedllvm/test/Transforms/SimplifyCFG/2006-08-03-Crash.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/UncondBranchToReturn.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/duplicate-landingpad.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/rangereduce.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/switch-on-const-select.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/X86/switch-covered-bug.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/pr39807.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/ConditionalTrappingConstantExpr.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/PR9946.ll
The file was modifiedllvm/test/Transforms/PhaseOrdering/unsigned-multiply-overflow-check.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/2005-08-01-PHIUpdateFail.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/ARM/speculate-math.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/DeadSetCC.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/bbi-23595.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/hoist-with-range.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/fold-debug-info.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/RISCV/select-trunc-i64.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/hoist-dbgvalue-inlined.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/switch_switch_fold.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/2004-12-10-SimplifyCFGCrash.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/HoistCode.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/PhiBlockMerge.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/X86/pr39187-g.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/pr46638.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/unsigned-multiplication-will-overflow.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/opt-for-fuzzing.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/branch-fold.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/safe-abs.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/speculate-with-offset.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/2008-09-08-MultiplePred.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/X86/SpeculativeExec.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/no-md-sink.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/invoke_unwind_lifetime.ll
The file was modifiedllvm/test/Transforms/IndVarSimplify/loop_evaluate_1.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/2008-12-16-DCECond.ll
The file was modifiedllvm/test/Transforms/GVNSink/indirect-call.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/UnreachableEliminate.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/unprofitable-pr.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/preserve-branchweights-partial.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/2005-06-16-PHICrash.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/branch-fold-threshold.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/X86/disable-lookup-table.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/signbit-like-value-extension.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/X86/safe-low-bit-extract.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/speculate-vector-ops.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/extract-cost.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/X86/PR29163.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/X86/switch-table-bug.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/hoist-common-code.ll
The file was modifiedllvm/test/Transforms/IndVarSimplify/loop_evaluate_2.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/basictest.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/speculate-math.ll
The file was modifiedllvm/test/Transforms/LoopVectorize/if-pred-non-void.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/switch-to-select-two-case.ll
The file was modifiedllvm/test/Transforms/GVNSink/sink-common-code.ll
The file was modifiedllvm/lib/Transforms/Utils/SimplifyCFG.cpp
The file was modifiedllvm/test/Transforms/SimplifyCFG/ARM/branch-fold-threshold.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/BrUnwind.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/X86/speculate-cttz-ctlz.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/switch-masked-bits.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/ARM/select-trunc-i64.ll
The file was modifiedllvm/test/Transforms/LoopDeletion/simplify-then-delete.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/common-dest-folding.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/switch_thread.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/ARM/phi-eliminate.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/indirectbr.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/switch-range-to-icmp.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/switch-simplify-crash.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/PhiEliminate3.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/PhiEliminate2.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/2006-12-08-Ptr-ICmp-Branch.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/preserve-branchweights.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/fold-debug-location.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/clamp.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/debug-info-thread-phi.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/annotations.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/branch-phi-thread.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/X86/CoveredLookupTable.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/branch-fold-dbg.ll
Commit 4be8707e6450fafceaad2fc2ea86dc4b5d4bdd4f by lebedev.ri
[SimplifyCFG] Teach FoldTwoEntryPHINode() to preserve DomTree

Still boring, simply drop all edges to successors of DomBlock,
and add an edge to to BB instead.
The file was modifiedllvm/test/Transforms/SimplifyCFG/PhiBlockMerge.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/X86/speculate-cttz-ctlz.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/signbit-like-value-extension.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/PhiEliminate3.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/X86/SpeculativeExec.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/speculate-math.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/ARM/phi-eliminate.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/ARM/select-trunc-i64.ll
The file was modifiedllvm/lib/Transforms/Utils/SimplifyCFG.cpp
The file was modifiedllvm/test/Transforms/SimplifyCFG/unsigned-multiplication-will-overflow.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/speculate-with-offset.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/ARM/speculate-math.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/ARM/speculate-vector-ops.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/UnreachableEliminate.ll
The file was modifiedllvm/test/Transforms/IndVarSimplify/loop_evaluate_1.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/safe-abs.ll
The file was modifiedllvm/test/Transforms/PhaseOrdering/unsigned-multiply-overflow-check.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/clamp.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/opt-for-fuzzing.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/X86/safe-low-bit-extract.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/X86/PR29163.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/PR9946.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/PhiEliminate2.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/bbi-23595.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/ConditionalTrappingConstantExpr.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/no-md-sink.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/hoist-dbgvalue-inlined.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/RISCV/select-trunc-i64.ll
The file was modifiedllvm/test/Transforms/IndVarSimplify/loop_evaluate_2.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/speculate-vector-ops.ll
Commit 76e74d939509a71ae2416744a5659fc6a30fb2c5 by lebedev.ri
[SimplifyCFG] Teach removeEmptyCleanup() to preserve DomTree
The file was modifiedllvm/lib/Transforms/Utils/SimplifyCFG.cpp
The file was modifiedllvm/test/Transforms/Coroutines/coro-heap-elide.ll
Commit c209b88dd438747a39bb16fb99e55703df7b5e54 by lebedev.ri
[SimplifyCFG] Teach simplifyCommonResume() to preserve DomTree
The file was modifiedllvm/test/Transforms/SimplifyCFG/X86/bug-25299.ll
The file was modifiedllvm/lib/Transforms/Utils/SimplifyCFG.cpp
The file was modifiedllvm/test/Transforms/SimplifyCFG/invoke_unwind_lifetime.ll
Commit b7d00e29b772511da268643488fde8af3645e5d2 by lebedev.ri
[SimplifyCFG] Teach simplifySingleResume() to preserve DomTree
The file was modifiedllvm/test/Transforms/SimplifyCFG/invoke_unwind.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/2011-09-05-TrivialLPad.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/lifetime-landingpad.ll
The file was modifiedllvm/lib/Transforms/Utils/SimplifyCFG.cpp
The file was modifiedllvm/test/Transforms/SimplifyCFG/X86/2010-03-30-InvokeCrash.ll
Commit 83659c707675f81680e355d98bd3600cd59a9278 by lebedev.ri
[SimplifyCFG] simplifySingleResume(): FoldReturnIntoUncondBranch() already knows how to preserve DomTree

... so just ensure that we pass DomTreeUpdater it into it.

Apparently, there were no dedicated tests just for that functionality,
so i'm adding one here.
The file was addedllvm/test/Transforms/SimplifyCFG/duplicate-ret-into-uncond-br.ll
The file was modifiedllvm/lib/Transforms/Utils/SimplifyCFG.cpp
Commit 4d87a6ad13c3ca3170f0eca05ac975bcced2e42f by lebedev.ri
[NFCI][SimplifyCFG] SimplifyCondBranchToTwoReturns(): pull out BI->getParent() into a variable
The file was modifiedllvm/lib/Transforms/Utils/SimplifyCFG.cpp
Commit b94520c9ee2ffdb15e8af2afa210e8eb76da9343 by lebedev.ri
[SimplifyCFG] Teach SimplifyCondBranchToTwoReturns() to preserve DomTree, part 1

... for the general case of returning a value.
The file was modifiedllvm/test/Transforms/LoopDeletion/simplify-then-delete.ll
The file was modifiedllvm/lib/Transforms/Utils/SimplifyCFG.cpp
The file was addedllvm/test/Transforms/SimplifyCFG/merge-duplicate-conditional-ret-val.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/2008-09-08-MultiplePred.ll
Commit 6a1617d67ccdf359d4250267be4431530308f351 by lebedev.ri
[SimplifyCFG] Teach SimplifyCondBranchToTwoReturns() to preserve DomTree, part 2

... for the custom case returning void.
The file was modifiedllvm/lib/Transforms/Utils/SimplifyCFG.cpp
The file was modifiedllvm/test/Transforms/SimplifyCFG/fold-debug-info.ll
Commit 262ff9c23e72643ba02db6166b6ca942ef067dc9 by lebedev.ri
[SimplifyCFG] Teach TryToMergeLandingPad() to preserve DomTree
The file was modifiedllvm/lib/Transforms/Utils/SimplifyCFG.cpp
The file was modifiedllvm/test/Transforms/SimplifyCFG/duplicate-landingpad.ll
Commit c043f5055e8968ed17d2763e47862c42050302e3 by lebedev.ri
[SimplifyCFG] Teach FoldBranchToCommonDest() to preserve DomTree, part 1

... for conditional branch case
The file was modifiedllvm/test/Transforms/SimplifyCFG/fold-debug-location.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/ARM/branch-fold-threshold.ll
The file was modifiedllvm/include/llvm/Transforms/Utils/Local.h
The file was modifiedllvm/test/Transforms/SimplifyCFG/common-dest-folding.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll
The file was modifiedllvm/test/Transforms/LoopVectorize/if-pred-non-void.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/branch-fold-dbg.ll
The file was modifiedllvm/lib/Transforms/Utils/SimplifyCFG.cpp
The file was modifiedllvm/test/Transforms/SimplifyCFG/annotations.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/basictest.ll
The file was modifiedllvm/lib/Transforms/Utils/LoopSimplify.cpp
The file was modifiedllvm/test/Transforms/SimplifyCFG/branch-fold-threshold.ll
The file was modifiedllvm/test/Transforms/SimplifyCFG/2006-12-08-Ptr-ICmp-Branch.ll