[PATCH] D111301: [VPlan] Make sure recurrence splice is not inserted between phis.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 7 04:25:55 PDT 2021
fhahn created this revision.
fhahn added reviewers: Ayal, gilr.
Herald added subscribers: tschuett, psnobl, rogfer01, bollu, hiraditya.
fhahn requested review of this revision.
Herald added a subscriber: vkmr.
Herald added a project: LLVM.
All phi-like recipes should be at the beginning of a VPBasicBlock with
no other recipes in between. Ensure that the recurrence-splicing recipe
is not added between phi-like recipes, but after them.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D111301
Files:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Index: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -9442,8 +9442,13 @@
if (auto *Region = GetReplicateRegion(PrevRecipe)) {
VPBasicBlock *Succ = cast<VPBasicBlock>(Region->getSingleSuccessor());
RecurSplice->moveBefore(*Succ, Succ->getFirstNonPhi());
- } else
- RecurSplice->moveAfter(PrevRecipe);
+ } else {
+ auto &VPBB = *PrevRecipe->getParent();
+ if (PrevRecipe->isPhi())
+ RecurSplice->moveBefore(VPBB, VPBB.getFirstNonPhi());
+ else
+ RecurSplice->moveAfter(PrevRecipe);
+ }
RecurPhi->replaceAllUsesWith(RecurSplice);
// Set the first operand of RecurSplice to RecurPhi again, after replacing
// all users.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111301.377801.patch
Type: text/x-patch
Size: 870 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211007/02b426c6/attachment.bin>
More information about the llvm-commits
mailing list