[llvm] 1a9e450 - [VPBuilder] Add setInsertPoint version taking a recipe directly (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 25 04:18:08 PDT 2023
Author: Florian Hahn
Date: 2023-09-25T12:17:53+01:00
New Revision: 1a9e45080f079207a990ab7965cc7f1b00cc0991
URL: https://github.com/llvm/llvm-project/commit/1a9e45080f079207a990ab7965cc7f1b00cc0991
DIFF: https://github.com/llvm/llvm-project/commit/1a9e45080f079207a990ab7965cc7f1b00cc0991.diff
LOG: [VPBuilder] Add setInsertPoint version taking a recipe directly (NFC).
This helps to slightly simplify code when a recipe can be obtained
easily. Suggested in D158779.
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
index 2df8fea85454ea3..6ef348d33567551 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
@@ -120,6 +120,13 @@ class VPBuilder {
InsertPt = IP;
}
+ /// This specifies that created instructions should be inserted at the
+ /// specified point.
+ void setInsertPoint(VPRecipeBase *IP) {
+ BB = IP->getParent();
+ InsertPt = IP->getIterator();
+ }
+
/// Create an N-ary operation with \p Opcode, \p Operands and set \p Inst as
/// its underlying Instruction.
VPValue *createNaryOp(unsigned Opcode, ArrayRef<VPValue *> Operands,
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index ee75eb69af777a7..4ba8dc85df79214 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -9133,7 +9133,7 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
VPValue *CondOp = nullptr;
if (CM.blockNeedsPredicationForAnyReason(BB)) {
VPBuilder::InsertPointGuard Guard(Builder);
- Builder.setInsertPoint(LinkVPBB, CurrentLink->getIterator());
+ Builder.setInsertPoint(CurrentLink);
CondOp = RecipeBuilder.createBlockInMask(BB, *Plan);
}
@@ -9153,7 +9153,7 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
// and the live-out instruction of each reduction, at the beginning of the
// dedicated latch block.
if (CM.foldTailByMasking()) {
- Builder.setInsertPoint(LatchVPBB, LatchVPBB->begin());
+ Builder.setInsertPoint(&*LatchVPBB->begin());
for (VPRecipeBase &R :
Plan->getVectorLoopRegion()->getEntryBasicBlock()->phis()) {
VPReductionPHIRecipe *PhiR = dyn_cast<VPReductionPHIRecipe>(&R);
More information about the llvm-commits
mailing list