[PATCH] D105700: [LoopSimplify] Convert loop with multiple latches to nested loop using dominator tree
JinGu Kang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 9 07:45:28 PDT 2021
jaykang10 created this revision.
jaykang10 added reviewers: eli.friedman, sanwou01.
Herald added subscribers: pengfei, asbirlea, hiraditya.
jaykang10 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
With certain condition of phi node, LoopSimplify pass converts loop with multiple latches to a nested loop as below.
// Loop with multiple latches
//
// | /----------------\
// +--------v----v------+ |
// | header <---\ |
// +--------------------+ | |
// | | |
// +--------v-----------+ | |
// | latch1 >---/ |
// +--------------------+ |
// | |
// +--------v-----------+ |
// | latch2 >----------/
// +--------------------+
// |
//==============================>
//
// A nested loop
//
// | /----------------\
// +-------------v------+ |
// | outer header | |
// +--------------------+ |
// | |
// +--------v----v------+ |
// | inner header <---\ |
// +--------------------+ | |
// | | |
// +--------v-----------+ | |
// | latch1 >---/ |
// +--------------------+ |
// | |
// +--------v-----------+ |
// | latch2 >----------/
// +--------------------+
// |
This patch enables above transformation more using dominator tree. If one latch dominates other latches, the latch can be inner loop's one.
https://reviews.llvm.org/D105700
Files:
llvm/lib/Transforms/Utils/LoopSimplify.cpp
llvm/test/CodeGen/AArch64/aarch64-loop-gep-opt.ll
llvm/test/CodeGen/X86/2008-04-28-CoalescerBug.ll
llvm/test/CodeGen/X86/2009-02-26-MachineLICMBug.ll
llvm/test/CodeGen/X86/bb_rotate.ll
llvm/test/Transforms/IndVarSimplify/2011-10-27-lftrnull.ll
llvm/test/Transforms/IndVarSimplify/rewrite-loop-exit-value.ll
llvm/test/Transforms/LICM/hoist-mustexec.ll
llvm/test/Transforms/LoopSimplifyCFG/constant-fold-branch.ll
llvm/test/Transforms/LoopSimplifyCFG/update_parents.ll
llvm/test/Transforms/LoopVectorize/loop-form.ll
llvm/test/Transforms/LoopVectorize/loop-legality-checks.ll
llvm/test/Transforms/LoopVectorize/skeleton-lcssa-crash.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105700.357504.patch
Type: text/x-patch
Size: 41606 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210709/97406215/attachment.bin>
More information about the llvm-commits
mailing list