[all-commits] [llvm/llvm-project] dcf945: [Transforms] Refactor CreateControlFlowHub
Sameer Sahasrabuddhe via All-commits
all-commits at lists.llvm.org
Tue Aug 13 00:02:31 PDT 2024
Branch: refs/heads/users/ssahasra/fix-irreducible
Home: https://github.com/llvm/llvm-project
Commit: dcf945e70ffca99592cb4ec277c13b28ca80adda
https://github.com/llvm/llvm-project/commit/dcf945e70ffca99592cb4ec277c13b28ca80adda
Author: Sameer Sahasrabuddhe <sameer.sahasrabuddhe at amd.com>
Date: 2024-08-13 (Tue, 13 Aug 2024)
Changed paths:
M llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
A llvm/include/llvm/Transforms/Utils/ControlFlowUtils.h
M llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
M llvm/lib/Transforms/Utils/CMakeLists.txt
A llvm/lib/Transforms/Utils/ControlFlowUtils.cpp
M llvm/lib/Transforms/Utils/FixIrreducible.cpp
M llvm/lib/Transforms/Utils/UnifyLoopExits.cpp
M llvm/test/CodeGen/AMDGPU/local-atomicrmw-fadd.ll
M llvm/test/Transforms/FixIrreducible/basic.ll
M llvm/test/Transforms/FixIrreducible/bug45623.ll
M llvm/test/Transforms/FixIrreducible/nested.ll
M llvm/test/Transforms/FixIrreducible/switch.ll
M llvm/test/Transforms/FixIrreducible/unreachable.ll
Log Message:
-----------
[Transforms] Refactor CreateControlFlowHub
CreateControlFlowHub is a method that redirects control flow edges from a set of
incoming blocks to a set of outgoing blocks through a new set of "guard" blocks.
This is now refactored into a separate file with one enhancement: The input to
the method is now a set of branches rather than two sets of blocks.
The original implementation reroutes every edge from incoming blocks to outgoing
blocks. But it is possible that for some incoming block InBB, some successor S
might be in the set of outgoing blocks, but that particular edge should not be
rerouted. The new implementation makes this possible by allowing the user to
specify the targets of each branch that need to be rerouted.
This is needed when improving the implementation of FixIrreducible #101386. Current
uses in FixIrreducible and UnifyLoopExits do not demonstrate this finer control
over the edges being rerouted.
Commit: 9280b05b0175d007669da5ee5aa2cc13a5f82e0c
https://github.com/llvm/llvm-project/commit/9280b05b0175d007669da5ee5aa2cc13a5f82e0c
Author: Sameer Sahasrabuddhe <sameer.sahasrabuddhe at amd.com>
Date: 2024-08-13 (Tue, 13 Aug 2024)
Changed paths:
M llvm/include/llvm/ADT/GenericCycleInfo.h
M llvm/lib/Transforms/Utils/FixIrreducible.cpp
M llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
M llvm/test/Transforms/FixIrreducible/basic.ll
M llvm/test/Transforms/FixIrreducible/bug45623.ll
M llvm/test/Transforms/FixIrreducible/nested.ll
M llvm/test/Transforms/FixIrreducible/switch.ll
M llvm/test/Transforms/FixIrreducible/unreachable.ll
M llvm/test/Transforms/StructurizeCFG/workarounds/needs-fix-reducible.ll
M llvm/test/Transforms/StructurizeCFG/workarounds/needs-fr-ule.ll
Log Message:
-----------
[FixIrreducible] Use CycleInfo instead of a custom SCC traversal
1. CycleInfo efficiently locates all cycles in a single pass, while the SCC is
repeated inside every natural loop.
2. CycleInfo provides a hierarchy of irreducible cycles, and the new
implementation transforms each cycle in this hierarchy separately instead of
reducing an entire irreducible SCC in a single step. This reduces the number
of control-flow paths that pass through the header of each newly created
loop. This is evidenced by the reduced number of predecessors on the "guard"
blocks in the lit tests, and fewer operands on the corresponding PHI nodes.
3. When an entry of an irreducible cycle is the header of a child natural loop,
the original implementation destroyed that loop. This is now preserved,
since the incoming edges on non-header entries are not touched.
Compare: https://github.com/llvm/llvm-project/compare/dcf945e70ffc%5E...9280b05b0175
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list