[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
Tue Oct 26 09:51:07 PDT 2021
fhahn updated this revision to Diff 382377.
fhahn marked an inline comment as done.
fhahn added a comment.
Updated to set the insert point of the builder up-front, rather than moving the created recipies later. Also removed unnneded isPhi check.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111301/new/
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
@@ -9454,16 +9454,18 @@
if (!RecurPhi)
continue;
- auto *RecurSplice = cast<VPInstruction>(
- Builder.createNaryOp(VPInstruction::FirstOrderRecurrenceSplice,
- {RecurPhi, RecurPhi->getBackedgeValue()}));
-
VPRecipeBase *PrevRecipe = RecurPhi->getBackedgeRecipe();
if (auto *Region = GetReplicateRegion(PrevRecipe)) {
VPBasicBlock *Succ = cast<VPBasicBlock>(Region->getSingleSuccessor());
- RecurSplice->moveBefore(*Succ, Succ->getFirstNonPhi());
+ Builder.setInsertPoint(Succ, Succ->getFirstNonPhi());
} else
- RecurSplice->moveAfter(PrevRecipe);
+ Builder.setInsertPoint(PrevRecipe->getParent(),
+ std::next(PrevRecipe->getIterator()));
+
+ auto *RecurSplice = cast<VPInstruction>(
+ Builder.createNaryOp(VPInstruction::FirstOrderRecurrenceSplice,
+ {RecurPhi, RecurPhi->getBackedgeValue()}));
+
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.382377.patch
Type: text/x-patch
Size: 1331 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211026/1626d00c/attachment.bin>
More information about the llvm-commits
mailing list