[PATCH] D75865: Introduce unify-loop-exits pass.
Sameer Sahasrabuddhe via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 9 11:52:35 PDT 2020
sameerds created this revision.
Herald added subscribers: llvm-commits, kerbowa, hiraditya, tpr, mgorny, nhaehnle, jvesely, arsenm.
Herald added a project: LLVM.
For each natural loop with multiple exit blocks, this pass creates a
new block N such that all exiting blocks now branch to N, and then
control flow is redistributed to all the original exit blocks.
The bulk of the tranformation is a new function introduced in
BasicBlockUtils that an redirect control flow from a set of incoming
blocks to a set of outgoing blocks via a common "hub".
This is a useful workaround for a limitation in the structurizer which
incorrectly orders blocks when processing a nest of loops. This pass
bypasses that issue by ensuring that each natural loop is recognized
as a separate region. Since the structurizer is a region pass, it no
longer sees a nest of loops in a single region, and instead processes
each "level" in the nesting as a separate region.
The AMDGPU backend provides a new option to enable this pass before
the structurizer, which may eventually be enabled by default.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D75865
Files:
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/LinkAllPasses.h
llvm/include/llvm/Transforms/Utils.h
llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
llvm/include/llvm/Transforms/Utils/Local.h
llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
llvm/lib/Transforms/Utils/CMakeLists.txt
llvm/lib/Transforms/Utils/Local.cpp
llvm/lib/Transforms/Utils/UnifyLoopExits.cpp
llvm/lib/Transforms/Utils/Utils.cpp
llvm/test/Transforms/StructurizeCFG/workarounds/needs-unified-loop-exits.ll
llvm/test/Transforms/UnifyLoopExits/basic.ll
llvm/test/Transforms/UnifyLoopExits/nested.ll
llvm/test/Transforms/UnifyLoopExits/restore-ssa.ll
llvm/tools/llc/llc.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75865.249178.patch
Type: text/x-patch
Size: 53312 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200309/a0514e84/attachment.bin>
More information about the llvm-commits
mailing list