[all-commits] [llvm/llvm-project] e08fea: [SimplifyCFGPass] Ensure that DominatorTreeWrapper...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Fri Jan 1 14:01:58 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e08fea3b240994572a4dd6b34bd846aef023a123
      https://github.com/llvm/llvm-project/commit/e08fea3b240994572a4dd6b34bd846aef023a123
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-02 (Sat, 02 Jan 2021)

  Changed paths:
    M llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp

  Log Message:
  -----------
  [SimplifyCFGPass] Ensure that DominatorTreeWrapperPass is init'd before SimplifyCFG

It's probably better than hoping that it will happen to be
already initialized.


  Commit: f1ce6960561bc28129fa3306f57a5c6df21258ab
      https://github.com/llvm/llvm-project/commit/f1ce6960561bc28129fa3306f57a5c6df21258ab
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-02 (Sat, 02 Jan 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/Transforms/SimplifyCFG/wc-widen-block.ll

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


  Commit: 657c1e09da9fb5e63b963fe8eeace01e42e7d3ba
      https://github.com/llvm/llvm-project/commit/657c1e09da9fb5e63b963fe8eeace01e42e7d3ba
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-02 (Sat, 02 Jan 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/Transforms/SimplifyCFG/switch-dead-default.ll

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


  Commit: db753269d912936d9ab27018faf867afce4b16de
      https://github.com/llvm/llvm-project/commit/db753269d912936d9ab27018faf867afce4b16de
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-02 (Sat, 02 Jan 2021)

  Changed paths:
    M llvm/unittests/IR/PassManagerTest.cpp

  Log Message:
  -----------
  [IR] PassManagerTest: Register DominatorTreeAnalysis before running SimplifyCFGPass

Otherwise these particular tests fail when SimplifyCFG requires DomTree


  Commit: 5fe0798dee6e2093aad7be11956c2bcaaf61dc8c
      https://github.com/llvm/llvm-project/commit/5fe0798dee6e2093aad7be11956c2bcaaf61dc8c
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-02 (Sat, 02 Jan 2021)

  Changed paths:
    M llvm/unittests/Transforms/Utils/LocalTest.cpp

  Log Message:
  -----------
  [Utils] LocalTest: fix SimplifyCFGWithNullAC test to work with `-simplifycfg-require-and-preserve-domtree=1`


  Commit: c38739ad8f10beb3144abcfebdcf50547328d346
      https://github.com/llvm/llvm-project/commit/c38739ad8f10beb3144abcfebdcf50547328d346
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-02 (Sat, 02 Jan 2021)

  Changed paths:
    M llvm/lib/CodeGen/DwarfEHPrepare.cpp

  Log Message:
  -----------
  [NFC] clang-format the entire DwarfEHPrepare.cpp


  Commit: e6b1a27fb9c71a9a81439917368a25ddc7d371a9
      https://github.com/llvm/llvm-project/commit/e6b1a27fb9c71a9a81439917368a25ddc7d371a9
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-02 (Sat, 02 Jan 2021)

  Changed paths:
    M llvm/include/llvm/InitializePasses.h
    M llvm/lib/CodeGen/CodeGen.cpp
    M llvm/lib/CodeGen/DwarfEHPrepare.cpp
    M llvm/tools/opt/opt.cpp

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


  Commit: b23b1bcc26e775a4998a78b6fe256e8cb0e3e0d3
      https://github.com/llvm/llvm-project/commit/b23b1bcc26e775a4998a78b6fe256e8cb0e3e0d3
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-02 (Sat, 02 Jan 2021)

  Changed paths:
    M llvm/test/CodeGen/AArch64/pic-eh-stubs.ll
    M llvm/test/CodeGen/AMDGPU/atomic_optimizations_pixelshader.ll
    M llvm/test/CodeGen/AMDGPU/branch-condition-and.ll
    M llvm/test/CodeGen/AMDGPU/branch-relaxation.ll
    M llvm/test/CodeGen/AMDGPU/infinite-loop.ll
    M llvm/test/CodeGen/AMDGPU/kill-infinite-loop.ll
    M llvm/test/CodeGen/AMDGPU/mixed-wave32-wave64.ll
    M llvm/test/CodeGen/AMDGPU/multi-divergent-exit-region.ll
    M llvm/test/CodeGen/AMDGPU/ret_jump.ll
    M llvm/test/CodeGen/AMDGPU/si-annotate-cf-noloop.ll
    M llvm/test/CodeGen/AMDGPU/si-lower-control-flow-unreachable-block.ll
    M llvm/test/CodeGen/AMDGPU/skip-if-dead.ll
    M llvm/test/CodeGen/AMDGPU/unigine-liveness-crash.ll
    M llvm/test/CodeGen/AMDGPU/unstructured-cfg-def-use-issue.ll
    M llvm/test/CodeGen/AMDGPU/update-phi.ll
    M llvm/test/CodeGen/AMDGPU/valu-i1.ll
    M llvm/test/CodeGen/AMDGPU/wave32.ll
    M llvm/test/CodeGen/ARM/2011-05-04-MultipleLandingPadSuccs.ll
    M llvm/test/CodeGen/ARM/2014-05-14-DwarfEHCrash.ll
    M llvm/test/CodeGen/ARM/arm-ttype-target2.ll
    M llvm/test/CodeGen/ARM/dwarf-eh.ll
    M llvm/test/CodeGen/ARM/ehabi-filters.ll
    M llvm/test/CodeGen/ARM/global-merge.ll
    M llvm/test/CodeGen/ARM/setjmp_longjmp.ll
    M llvm/test/CodeGen/Hexagon/cfi_offset.ll
    M llvm/test/CodeGen/Hexagon/ehabi.ll
    M llvm/test/CodeGen/Hexagon/misaligned_double_vector_store_not_fast.ll
    M llvm/test/CodeGen/Hexagon/packetize-allocframe.ll
    M llvm/test/CodeGen/Hexagon/swp-epilog-phi10.ll
    M llvm/test/CodeGen/Hexagon/swp-order-deps3.ll
    M llvm/test/CodeGen/Hexagon/swp-reuse-phi-4.ll
    M llvm/test/CodeGen/PowerPC/2007-11-16-landingpad-split.ll
    M llvm/test/CodeGen/PowerPC/aix-exception.ll
    M llvm/test/CodeGen/SPARC/exception.ll
    M llvm/test/CodeGen/Thumb2/2009-08-04-CoalescerBug.ll
    M llvm/test/CodeGen/X86/2007-05-05-Personality.ll
    M llvm/test/CodeGen/X86/2010-08-04-MingWCrash.ll
    M llvm/test/CodeGen/X86/2012-01-10-UndefExceptionEdge.ll
    M llvm/test/CodeGen/X86/basic-block-sections-eh.ll
    M llvm/test/CodeGen/X86/code-model-kernel.ll
    M llvm/test/CodeGen/X86/dwarf-eh-prepare.ll
    M llvm/test/CodeGen/X86/gcc_except_table-multi.ll
    M llvm/test/CodeGen/X86/indirect-branch-tracking-eh2.ll

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


  Commit: 2461cdb41724298591133c811df82b0064adfa6b
      https://github.com/llvm/llvm-project/commit/2461cdb41724298591133c811df82b0064adfa6b
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-02 (Sat, 02 Jan 2021)

  Changed paths:
    M llvm/lib/CodeGen/DwarfEHPrepare.cpp
    M llvm/test/CodeGen/AArch64/pic-eh-stubs.ll
    M llvm/test/CodeGen/ARM/2011-05-04-MultipleLandingPadSuccs.ll
    M llvm/test/CodeGen/ARM/2014-05-14-DwarfEHCrash.ll
    M llvm/test/CodeGen/ARM/arm-ttype-target2.ll
    M llvm/test/CodeGen/ARM/dwarf-eh.ll
    M llvm/test/CodeGen/ARM/ehabi-filters.ll
    M llvm/test/CodeGen/ARM/global-merge.ll
    M llvm/test/CodeGen/ARM/setjmp_longjmp.ll
    M llvm/test/CodeGen/Hexagon/cfi_offset.ll
    M llvm/test/CodeGen/Hexagon/ehabi.ll
    M llvm/test/CodeGen/Hexagon/packetize-allocframe.ll
    M llvm/test/CodeGen/PowerPC/2007-11-16-landingpad-split.ll
    M llvm/test/CodeGen/PowerPC/aix-exception.ll
    M llvm/test/CodeGen/SPARC/exception.ll
    M llvm/test/CodeGen/X86/2007-05-05-Personality.ll
    M llvm/test/CodeGen/X86/2010-08-04-MingWCrash.ll
    M llvm/test/CodeGen/X86/2012-01-10-UndefExceptionEdge.ll
    M llvm/test/CodeGen/X86/basic-block-sections-eh.ll
    M llvm/test/CodeGen/X86/code-model-kernel.ll
    M llvm/test/CodeGen/X86/dwarf-eh-prepare.ll
    M llvm/test/CodeGen/X86/gcc_except_table-multi.ll
    M llvm/test/CodeGen/X86/indirect-branch-tracking-eh2.ll

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


  Commit: b4429f3cdd1a8511bd014877b22d9679c4a74dbd
      https://github.com/llvm/llvm-project/commit/b4429f3cdd1a8511bd014877b22d9679c4a74dbd
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-02 (Sat, 02 Jan 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/CodeGen/Hexagon/misaligned_double_vector_store_not_fast.ll
    M llvm/test/CodeGen/Hexagon/swp-epilog-phi10.ll
    M llvm/test/CodeGen/Hexagon/swp-order-deps3.ll
    M llvm/test/CodeGen/Hexagon/swp-reuse-phi-4.ll
    M llvm/test/CodeGen/Thumb2/2009-08-04-CoalescerBug.ll

  Log Message:
  -----------
  [SimplifyCFG] Teach removeUndefIntroducingPredecessor to preserve DomTree


  Commit: 4b80647367950ba3da6a08260487fd0dbc50a9c5
      https://github.com/llvm/llvm-project/commit/4b80647367950ba3da6a08260487fd0dbc50a9c5
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-02 (Sat, 02 Jan 2021)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPUUnifyDivergentExitNodes.cpp
    M llvm/test/CodeGen/AMDGPU/atomic_optimizations_pixelshader.ll
    M llvm/test/CodeGen/AMDGPU/branch-condition-and.ll
    M llvm/test/CodeGen/AMDGPU/branch-relaxation.ll
    M llvm/test/CodeGen/AMDGPU/infinite-loop.ll
    M llvm/test/CodeGen/AMDGPU/kill-infinite-loop.ll
    M llvm/test/CodeGen/AMDGPU/mixed-wave32-wave64.ll
    M llvm/test/CodeGen/AMDGPU/multi-divergent-exit-region.ll
    M llvm/test/CodeGen/AMDGPU/ret_jump.ll
    M llvm/test/CodeGen/AMDGPU/si-annotate-cf-noloop.ll
    M llvm/test/CodeGen/AMDGPU/si-lower-control-flow-unreachable-block.ll
    M llvm/test/CodeGen/AMDGPU/skip-if-dead.ll
    M llvm/test/CodeGen/AMDGPU/unigine-liveness-crash.ll
    M llvm/test/CodeGen/AMDGPU/unstructured-cfg-def-use-issue.ll
    M llvm/test/CodeGen/AMDGPU/update-phi.ll
    M llvm/test/CodeGen/AMDGPU/valu-i1.ll
    M llvm/test/CodeGen/AMDGPU/wave32.ll

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


Compare: https://github.com/llvm/llvm-project/compare/9a90c4ea8a05...4b8064736795


More information about the All-commits mailing list