[all-commits] [llvm/llvm-project] b43b77: [NFCI][SimlifyCFG] simplifyOnce(): also perform Do...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Sat Dec 19 13:19:18 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b43b77ff9b82d53321e401cf1ededdaf30fff407
      https://github.com/llvm/llvm-project/commit/b43b77ff9b82d53321e401cf1ededdaf30fff407
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-20 (Sun, 20 Dec 2020)

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

  Log Message:
  -----------
  [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.


  Commit: 4be8707e6450fafceaad2fc2ea86dc4b5d4bdd4f
      https://github.com/llvm/llvm-project/commit/4be8707e6450fafceaad2fc2ea86dc4b5d4bdd4f
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-20 (Sun, 20 Dec 2020)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/Transforms/IndVarSimplify/loop_evaluate_1.ll
    M llvm/test/Transforms/IndVarSimplify/loop_evaluate_2.ll
    M llvm/test/Transforms/PhaseOrdering/unsigned-multiply-overflow-check.ll
    M llvm/test/Transforms/SimplifyCFG/ARM/phi-eliminate.ll
    M llvm/test/Transforms/SimplifyCFG/ARM/select-trunc-i64.ll
    M llvm/test/Transforms/SimplifyCFG/ARM/speculate-math.ll
    M llvm/test/Transforms/SimplifyCFG/ARM/speculate-vector-ops.ll
    M llvm/test/Transforms/SimplifyCFG/ConditionalTrappingConstantExpr.ll
    M llvm/test/Transforms/SimplifyCFG/PR9946.ll
    M llvm/test/Transforms/SimplifyCFG/PhiBlockMerge.ll
    M llvm/test/Transforms/SimplifyCFG/PhiEliminate2.ll
    M llvm/test/Transforms/SimplifyCFG/PhiEliminate3.ll
    M llvm/test/Transforms/SimplifyCFG/RISCV/select-trunc-i64.ll
    M llvm/test/Transforms/SimplifyCFG/UnreachableEliminate.ll
    M llvm/test/Transforms/SimplifyCFG/X86/PR29163.ll
    M llvm/test/Transforms/SimplifyCFG/X86/SpeculativeExec.ll
    M llvm/test/Transforms/SimplifyCFG/X86/safe-low-bit-extract.ll
    M llvm/test/Transforms/SimplifyCFG/X86/speculate-cttz-ctlz.ll
    M llvm/test/Transforms/SimplifyCFG/bbi-23595.ll
    M llvm/test/Transforms/SimplifyCFG/clamp.ll
    M llvm/test/Transforms/SimplifyCFG/hoist-dbgvalue-inlined.ll
    M llvm/test/Transforms/SimplifyCFG/no-md-sink.ll
    M llvm/test/Transforms/SimplifyCFG/opt-for-fuzzing.ll
    M llvm/test/Transforms/SimplifyCFG/safe-abs.ll
    M llvm/test/Transforms/SimplifyCFG/signbit-like-value-extension.ll
    M llvm/test/Transforms/SimplifyCFG/speculate-math.ll
    M llvm/test/Transforms/SimplifyCFG/speculate-vector-ops.ll
    M llvm/test/Transforms/SimplifyCFG/speculate-with-offset.ll
    M llvm/test/Transforms/SimplifyCFG/unsigned-multiplication-will-overflow.ll

  Log Message:
  -----------
  [SimplifyCFG] Teach FoldTwoEntryPHINode() to preserve DomTree

Still boring, simply drop all edges to successors of DomBlock,
and add an edge to to BB instead.


  Commit: 76e74d939509a71ae2416744a5659fc6a30fb2c5
      https://github.com/llvm/llvm-project/commit/76e74d939509a71ae2416744a5659fc6a30fb2c5
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-20 (Sun, 20 Dec 2020)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/Transforms/Coroutines/coro-heap-elide.ll

  Log Message:
  -----------
  [SimplifyCFG] Teach removeEmptyCleanup() to preserve DomTree


  Commit: c209b88dd438747a39bb16fb99e55703df7b5e54
      https://github.com/llvm/llvm-project/commit/c209b88dd438747a39bb16fb99e55703df7b5e54
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-20 (Sun, 20 Dec 2020)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/Transforms/SimplifyCFG/X86/bug-25299.ll
    M llvm/test/Transforms/SimplifyCFG/invoke_unwind_lifetime.ll

  Log Message:
  -----------
  [SimplifyCFG] Teach simplifyCommonResume() to preserve DomTree


  Commit: b7d00e29b772511da268643488fde8af3645e5d2
      https://github.com/llvm/llvm-project/commit/b7d00e29b772511da268643488fde8af3645e5d2
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-20 (Sun, 20 Dec 2020)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/Transforms/SimplifyCFG/2011-09-05-TrivialLPad.ll
    M llvm/test/Transforms/SimplifyCFG/X86/2010-03-30-InvokeCrash.ll
    M llvm/test/Transforms/SimplifyCFG/invoke_unwind.ll
    M llvm/test/Transforms/SimplifyCFG/lifetime-landingpad.ll

  Log Message:
  -----------
  [SimplifyCFG] Teach simplifySingleResume() to preserve DomTree


  Commit: 83659c707675f81680e355d98bd3600cd59a9278
      https://github.com/llvm/llvm-project/commit/83659c707675f81680e355d98bd3600cd59a9278
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-20 (Sun, 20 Dec 2020)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    A llvm/test/Transforms/SimplifyCFG/duplicate-ret-into-uncond-br.ll

  Log Message:
  -----------
  [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.


  Commit: 4d87a6ad13c3ca3170f0eca05ac975bcced2e42f
      https://github.com/llvm/llvm-project/commit/4d87a6ad13c3ca3170f0eca05ac975bcced2e42f
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-20 (Sun, 20 Dec 2020)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp

  Log Message:
  -----------
  [NFCI][SimplifyCFG] SimplifyCondBranchToTwoReturns(): pull out BI->getParent() into a variable


  Commit: b94520c9ee2ffdb15e8af2afa210e8eb76da9343
      https://github.com/llvm/llvm-project/commit/b94520c9ee2ffdb15e8af2afa210e8eb76da9343
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-20 (Sun, 20 Dec 2020)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/Transforms/LoopDeletion/simplify-then-delete.ll
    M llvm/test/Transforms/SimplifyCFG/2008-09-08-MultiplePred.ll
    A llvm/test/Transforms/SimplifyCFG/merge-duplicate-conditional-ret-val.ll

  Log Message:
  -----------
  [SimplifyCFG] Teach SimplifyCondBranchToTwoReturns() to preserve DomTree, part 1

... for the general case of returning a value.


  Commit: 6a1617d67ccdf359d4250267be4431530308f351
      https://github.com/llvm/llvm-project/commit/6a1617d67ccdf359d4250267be4431530308f351
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-20 (Sun, 20 Dec 2020)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/Transforms/SimplifyCFG/fold-debug-info.ll

  Log Message:
  -----------
  [SimplifyCFG] Teach SimplifyCondBranchToTwoReturns() to preserve DomTree, part 2

... for the custom case returning void.


  Commit: 262ff9c23e72643ba02db6166b6ca942ef067dc9
      https://github.com/llvm/llvm-project/commit/262ff9c23e72643ba02db6166b6ca942ef067dc9
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-20 (Sun, 20 Dec 2020)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/Transforms/SimplifyCFG/duplicate-landingpad.ll

  Log Message:
  -----------
  [SimplifyCFG] Teach TryToMergeLandingPad() to preserve DomTree


  Commit: c043f5055e8968ed17d2763e47862c42050302e3
      https://github.com/llvm/llvm-project/commit/c043f5055e8968ed17d2763e47862c42050302e3
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-20 (Sun, 20 Dec 2020)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/Local.h
    M llvm/lib/Transforms/Utils/LoopSimplify.cpp
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/Transforms/LoopVectorize/if-pred-non-void.ll
    M llvm/test/Transforms/SimplifyCFG/2006-12-08-Ptr-ICmp-Branch.ll
    M llvm/test/Transforms/SimplifyCFG/ARM/branch-fold-threshold.ll
    M llvm/test/Transforms/SimplifyCFG/annotations.ll
    M llvm/test/Transforms/SimplifyCFG/basictest.ll
    M llvm/test/Transforms/SimplifyCFG/branch-fold-dbg.ll
    M llvm/test/Transforms/SimplifyCFG/branch-fold-threshold.ll
    M llvm/test/Transforms/SimplifyCFG/common-dest-folding.ll
    M llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll
    M llvm/test/Transforms/SimplifyCFG/fold-debug-location.ll

  Log Message:
  -----------
  [SimplifyCFG] Teach FoldBranchToCommonDest() to preserve DomTree, part 1

... for conditional branch case


Compare: https://github.com/llvm/llvm-project/compare/c52bcf3a9b2d...c043f5055e89


More information about the All-commits mailing list