Skip to content

Commit 033f430

Browse files
committed
[VPlan] Populate and use VPIRMetadata from VPInstructions (NFC)
Update VPlan to populate VPIRMetadata during VPInstruction construction and use it when creating widened recipes, instead of constructing VPIRMetadata from the underlying IR instruction each time. This centralizes VPIRMetadata in VPInstructions and ensures metadata is consistently available throughout VPlan transformations.
1 parent 321b9d1 commit 033f430

File tree

9 files changed

+100
-87
lines changed

9 files changed

+100
-87
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ class VPBuilder {
6565
VPInstruction *createInstruction(unsigned Opcode,
6666
ArrayRef<VPValue *> Operands, DebugLoc DL,
6767
const Twine &Name = "") {
68-
return tryInsertInstruction(new VPInstruction(Opcode, Operands, DL, Name));
68+
return tryInsertInstruction(
69+
new VPInstruction(Opcode, Operands, {}, DL, Name));
6970
}
7071

7172
public:
@@ -150,11 +151,11 @@ class VPBuilder {
150151
/// its underlying Instruction.
151152
VPInstruction *createNaryOp(unsigned Opcode, ArrayRef<VPValue *> Operands,
152153
Instruction *Inst = nullptr,
154+
const VPIRMetadata &MD = {},
155+
DebugLoc DL = DebugLoc::getUnknown(),
153156
const Twine &Name = "") {
154-
DebugLoc DL = DebugLoc::getUnknown();
155-
if (Inst)
156-
DL = Inst->getDebugLoc();
157-
VPInstruction *NewVPInst = createInstruction(Opcode, Operands, DL, Name);
157+
VPInstruction *NewVPInst =
158+
tryInsertInstruction(new VPInstruction(Opcode, Operands, MD, DL, Name));
158159
NewVPInst->setUnderlyingValue(Inst);
159160
return NewVPInst;
160161
}
@@ -211,7 +212,7 @@ class VPBuilder {
211212
DebugLoc DL = DebugLoc::getUnknown(),
212213
const Twine &Name = "") {
213214
return tryInsertInstruction(
214-
new VPInstruction(VPInstruction::LogicalAnd, {LHS, RHS}, DL, Name));
215+
new VPInstruction(VPInstruction::LogicalAnd, {LHS, RHS}, {}, DL, Name));
215216
}
216217

217218
VPInstruction *
@@ -222,7 +223,7 @@ class VPBuilder {
222223
FMFs ? new VPInstruction(Instruction::Select, {Cond, TrueVal, FalseVal},
223224
*FMFs, {}, DL, Name)
224225
: new VPInstruction(Instruction::Select, {Cond, TrueVal, FalseVal},
225-
DL, Name);
226+
{}, DL, Name);
226227
return tryInsertInstruction(Select);
227228
}
228229

@@ -328,7 +329,7 @@ class VPBuilder {
328329
else if (Opcode == Instruction::ZExt)
329330
Flags = VPIRFlags::NonNegFlagsTy(false);
330331
return tryInsertInstruction(
331-
new VPWidenCastRecipe(Opcode, Op, ResultTy, Flags));
332+
new VPWidenCastRecipe(Opcode, Op, ResultTy, nullptr, Flags));
332333
}
333334

334335
VPScalarIVStepsRecipe *

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7616,14 +7616,13 @@ VPWidenMemoryRecipe *VPRecipeBuilder::tryToWidenMemory(VPInstruction *VPI,
76167616
}
76177617
if (VPI->getOpcode() == Instruction::Load) {
76187618
auto *Load = cast<LoadInst>(I);
7619-
return new VPWidenLoadRecipe(*Load, Ptr, Mask, Consecutive, Reverse,
7620-
VPIRMetadata(*Load, LVer), I->getDebugLoc());
7619+
return new VPWidenLoadRecipe(*Load, Ptr, Mask, Consecutive, Reverse, *VPI,
7620+
VPI->getDebugLoc());
76217621
}
76227622

76237623
StoreInst *Store = cast<StoreInst>(I);
76247624
return new VPWidenStoreRecipe(*Store, Ptr, VPI->getOperand(0), Mask,
7625-
Consecutive, Reverse,
7626-
VPIRMetadata(*Store, LVer), VPI->getDebugLoc());
7625+
Consecutive, Reverse, *VPI, VPI->getDebugLoc());
76277626
}
76287627

76297628
/// Creates a VPWidenIntOrFpInductionRecipe for \p PhiR. If needed, it will
@@ -7751,7 +7750,7 @@ VPSingleDefRecipe *VPRecipeBuilder::tryToWidenCall(VPInstruction *VPI,
77517750
},
77527751
Range);
77537752
if (ShouldUseVectorIntrinsic)
7754-
return new VPWidenIntrinsicRecipe(*CI, ID, Ops, CI->getType(),
7753+
return new VPWidenIntrinsicRecipe(*CI, ID, Ops, CI->getType(), *VPI,
77557754
VPI->getDebugLoc());
77567755

77577756
Function *Variant = nullptr;
@@ -7843,7 +7842,7 @@ VPWidenRecipe *VPRecipeBuilder::tryToWiden(VPInstruction *VPI) {
78437842
auto *SafeRHS =
78447843
Builder.createSelect(Mask, Ops[1], One, VPI->getDebugLoc());
78457844
Ops[1] = SafeRHS;
7846-
return new VPWidenRecipe(*I, Ops);
7845+
return new VPWidenRecipe(*I, Ops, *VPI, VPI->getDebugLoc());
78477846
}
78487847
[[fallthrough]];
78497848
}
@@ -7889,15 +7888,15 @@ VPWidenRecipe *VPRecipeBuilder::tryToWiden(VPInstruction *VPI) {
78897888
// For other binops, the legacy cost model only checks the second operand.
78907889
NewOps[1] = GetConstantViaSCEV(NewOps[1]);
78917890
}
7892-
return new VPWidenRecipe(*I, NewOps);
7891+
return new VPWidenRecipe(*I, NewOps, *VPI, VPI->getDebugLoc());
78937892
}
78947893
case Instruction::ExtractValue: {
78957894
SmallVector<VPValue *> NewOps(VPI->operands());
78967895
auto *EVI = cast<ExtractValueInst>(I);
78977896
assert(EVI->getNumIndices() == 1 && "Expected one extractvalue index");
78987897
unsigned Idx = EVI->getIndices()[0];
78997898
NewOps.push_back(Plan.getConstantInt(32, Idx));
7900-
return new VPWidenRecipe(*I, NewOps);
7899+
return new VPWidenRecipe(*I, NewOps, *VPI, VPI->getDebugLoc());
79017900
}
79027901
};
79037902
}
@@ -7981,8 +7980,8 @@ VPReplicateRecipe *VPRecipeBuilder::handleReplication(VPInstruction *VPI,
79817980
assert((Range.Start.isScalar() || !IsUniform || !IsPredicated ||
79827981
(Range.Start.isScalable() && isa<IntrinsicInst>(I))) &&
79837982
"Should not predicate a uniform recipe");
7984-
auto *Recipe = new VPReplicateRecipe(I, VPI->operands(), IsUniform,
7985-
BlockInMask, VPIRMetadata(*I, LVer));
7983+
auto *Recipe =
7984+
new VPReplicateRecipe(I, VPI->operands(), IsUniform, BlockInMask, *VPI);
79867985
return Recipe;
79877986
}
79887987

@@ -8241,7 +8240,7 @@ VPRecipeBase *VPRecipeBuilder::tryToCreateWidenRecipe(VPSingleDefRecipe *R,
82418240
auto *CastR = cast<VPInstructionWithType>(R);
82428241
auto *CI = cast<CastInst>(Instr);
82438242
return new VPWidenCastRecipe(CI->getOpcode(), VPI->getOperand(0),
8244-
CastR->getResultType(), *CI);
8243+
CastR->getResultType(), CI, *VPI, *VPI);
82458244
}
82468245

82478246
return tryToWiden(VPI);
@@ -8269,7 +8268,8 @@ VPRecipeBuilder::tryToCreatePartialReduction(VPInstruction *Reduction,
82698268
SmallVector<VPValue *, 2> Ops;
82708269
Ops.push_back(Plan.getOrAddLiveIn(Zero));
82718270
Ops.push_back(BinOp);
8272-
BinOp = new VPWidenRecipe(*ReductionI, Ops);
8271+
BinOp = new VPWidenRecipe(*ReductionI, Ops, VPIRMetadata(),
8272+
ReductionI->getDebugLoc());
82738273
Builder.insert(BinOp->getDefiningRecipe());
82748274
ReductionOpcode = Instruction::Add;
82758275
}
@@ -8302,7 +8302,7 @@ void LoopVectorizationPlanner::buildVPlansWithVPRecipes(ElementCount MinVF,
83028302
// candidates built later for specific VF ranges.
83038303
auto VPlan0 = VPlanTransforms::buildVPlan0(
83048304
OrigLoop, *LI, Legal->getWidestInductionType(),
8305-
getDebugLocFromInstOrOperands(Legal->getPrimaryInduction()), PSE);
8305+
getDebugLocFromInstOrOperands(Legal->getPrimaryInduction()), PSE, &LVer);
83068306

83078307
auto MaxVFTimes2 = MaxVF * 2;
83088308
for (ElementCount VF = MinVF; ElementCount::isKnownLT(VF, MaxVFTimes2);) {
@@ -8408,7 +8408,7 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(
84088408
// VPInstructions in the loop.
84098409
// ---------------------------------------------------------------------------
84108410
VPRecipeBuilder RecipeBuilder(*Plan, OrigLoop, TLI, &TTI, Legal, CM, PSE,
8411-
Builder, BlockMaskCache, LVer);
8411+
Builder, BlockMaskCache);
84128412
// TODO: Handle partial reductions with EVL tail folding.
84138413
if (!CM.foldTailWithEVL())
84148414
RecipeBuilder.collectScaledReductions(Range);
@@ -8453,9 +8453,9 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(
84538453
Legal->isInvariantAddressOfReduction(SI->getPointerOperand())) {
84548454
// Only create recipe for the final invariant store of the reduction.
84558455
if (Legal->isInvariantStoreOfReduction(SI)) {
8456-
auto *Recipe =
8457-
new VPReplicateRecipe(SI, R.operands(), true /* IsUniform */,
8458-
nullptr /*Mask*/, VPIRMetadata(*SI, LVer));
8456+
auto *Recipe = new VPReplicateRecipe(
8457+
SI, R.operands(), true /* IsUniform */, nullptr /*Mask*/,
8458+
*cast<VPInstruction>(SingleDef));
84598459
Recipe->insertBefore(*MiddleVPBB, MBIP);
84608460
}
84618461
R.eraseFromParent();
@@ -8606,7 +8606,7 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlan(VFRange &Range) {
86068606
// addScalarResumePhis.
86078607
DenseMap<VPBasicBlock *, VPValue *> BlockMaskCache;
86088608
VPRecipeBuilder RecipeBuilder(*Plan, OrigLoop, TLI, &TTI, Legal, CM, PSE,
8609-
Builder, BlockMaskCache, nullptr /*LVer*/);
8609+
Builder, BlockMaskCache);
86108610
for (auto &R : Plan->getVectorLoopRegion()->getEntryBasicBlock()->phis()) {
86118611
if (isa<VPCanonicalIVPHIRecipe>(&R))
86128612
continue;

llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ class VPRecipeBuilder {
8484
/// A mapping of partial reduction exit instructions to their scaling factor.
8585
DenseMap<const Instruction *, unsigned> ScaledReductionMap;
8686

87-
/// Loop versioning instance for getting noalias metadata guaranteed by
88-
/// runtime checks.
89-
LoopVersioning *LVer;
90-
9187
/// Check if \p I can be widened at the start of \p Range and possibly
9288
/// decrease the range such that the returned value holds for the entire \p
9389
/// Range. The function should not be called for memory instructions or calls.
@@ -144,11 +140,9 @@ class VPRecipeBuilder {
144140
LoopVectorizationLegality *Legal,
145141
LoopVectorizationCostModel &CM,
146142
PredicatedScalarEvolution &PSE, VPBuilder &Builder,
147-
DenseMap<VPBasicBlock *, VPValue *> &BlockMaskCache,
148-
LoopVersioning *LVer)
143+
DenseMap<VPBasicBlock *, VPValue *> &BlockMaskCache)
149144
: Plan(Plan), OrigLoop(OrigLoop), TLI(TLI), TTI(TTI), Legal(Legal),
150-
CM(CM), PSE(PSE), Builder(Builder), BlockMaskCache(BlockMaskCache),
151-
LVer(LVer) {}
145+
CM(CM), PSE(PSE), Builder(Builder), BlockMaskCache(BlockMaskCache) {}
152146

153147
std::optional<unsigned> getScalingForReduction(const Instruction *ExitInst) {
154148
auto It = ScaledReductionMap.find(ExitInst);

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,10 +1119,6 @@ class LLVM_ABI_FOR_TEST VPInstruction : public VPRecipeWithIRFlags,
11191119
#endif
11201120

11211121
public:
1122-
VPInstruction(unsigned Opcode, ArrayRef<VPValue *> Operands,
1123-
DebugLoc DL = DebugLoc::getUnknown(), const Twine &Name = "")
1124-
: VPInstruction(Opcode, Operands, {}, {}, DL, Name) {}
1125-
11261122
VPInstruction(unsigned Opcode, ArrayRef<VPValue *> Operands,
11271123
const VPIRFlags &Flags, const VPIRMetadata &MD = {},
11281124
DebugLoc DL = DebugLoc::getUnknown(), const Twine &Name = "");
@@ -1334,7 +1330,7 @@ class VPPhiAccessors {
13341330

13351331
struct LLVM_ABI_FOR_TEST VPPhi : public VPInstruction, public VPPhiAccessors {
13361332
VPPhi(ArrayRef<VPValue *> Operands, DebugLoc DL, const Twine &Name = "")
1337-
: VPInstruction(Instruction::PHI, Operands, DL, Name) {}
1333+
: VPInstruction(Instruction::PHI, Operands, {}, DL, Name) {}
13381334

13391335
static inline bool classof(const VPUser *U) {
13401336
auto *VPI = dyn_cast<VPInstruction>(U);
@@ -1478,9 +1474,12 @@ class LLVM_ABI_FOR_TEST VPWidenRecipe : public VPRecipeWithIRFlags,
14781474
: VPRecipeWithIRFlags(VPDef::VPWidenSC, Operands, Flags, DL),
14791475
VPIRMetadata(Metadata), Opcode(Opcode) {}
14801476

1481-
VPWidenRecipe(Instruction &I, ArrayRef<VPValue *> Operands)
1482-
: VPRecipeWithIRFlags(VPDef::VPWidenSC, Operands, I), VPIRMetadata(I),
1483-
Opcode(I.getOpcode()) {}
1477+
VPWidenRecipe(Instruction &I, ArrayRef<VPValue *> Operands,
1478+
const VPIRMetadata &Metadata, DebugLoc DL)
1479+
: VPRecipeWithIRFlags(VPDef::VPWidenSC, Operands, VPIRFlags(I), DL),
1480+
VPIRMetadata(Metadata), Opcode(I.getOpcode()) {
1481+
setUnderlyingValue(&I);
1482+
}
14841483

14851484
~VPWidenRecipe() override = default;
14861485

@@ -1521,31 +1520,26 @@ class VPWidenCastRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
15211520

15221521
public:
15231522
VPWidenCastRecipe(Instruction::CastOps Opcode, VPValue *Op, Type *ResultTy,
1524-
CastInst &UI)
1525-
: VPRecipeWithIRFlags(VPDef::VPWidenCastSC, Op, UI), VPIRMetadata(UI),
1526-
Opcode(Opcode), ResultTy(ResultTy) {
1527-
assert(UI.getOpcode() == Opcode &&
1528-
"opcode of underlying cast doesn't match");
1529-
}
1530-
1531-
VPWidenCastRecipe(Instruction::CastOps Opcode, VPValue *Op, Type *ResultTy,
1532-
const VPIRFlags &Flags = {},
1523+
CastInst *UI = nullptr, const VPIRFlags &Flags = {},
15331524
const VPIRMetadata &Metadata = {},
15341525
DebugLoc DL = DebugLoc::getUnknown())
1535-
: VPRecipeWithIRFlags(VPDef::VPWidenCastSC, Op, Flags, DL),
1526+
: VPRecipeWithIRFlags(VPDef::VPWidenCastSC, Op,
1527+
UI ? VPIRFlags(*UI) : Flags,
1528+
UI ? UI->getDebugLoc() : DL),
15361529
VPIRMetadata(Metadata), Opcode(Opcode), ResultTy(ResultTy) {
15371530
assert(flagsValidForOpcode(Opcode) &&
15381531
"Set flags not supported for the provided opcode");
1532+
assert((!UI || UI->getOpcode() == Opcode) &&
1533+
"opcode of underlying cast doesn't match");
1534+
setUnderlyingValue(UI);
15391535
}
15401536

15411537
~VPWidenCastRecipe() override = default;
15421538

15431539
VPWidenCastRecipe *clone() override {
1544-
auto *New = new VPWidenCastRecipe(Opcode, getOperand(0), ResultTy, *this,
1545-
*this, getDebugLoc());
1546-
if (auto *UV = getUnderlyingValue())
1547-
New->setUnderlyingValue(UV);
1548-
return New;
1540+
return new VPWidenCastRecipe(Opcode, getOperand(0), ResultTy,
1541+
cast_or_null<CastInst>(getUnderlyingValue()),
1542+
*this, *this, getDebugLoc());
15491543
}
15501544

15511545
VP_CLASSOF_IMPL(VPDef::VPWidenCastSC)
@@ -1590,9 +1584,10 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
15901584
public:
15911585
VPWidenIntrinsicRecipe(CallInst &CI, Intrinsic::ID VectorIntrinsicID,
15921586
ArrayRef<VPValue *> CallArguments, Type *Ty,
1587+
const VPIRMetadata &MD = {},
15931588
DebugLoc DL = DebugLoc::getUnknown())
15941589
: VPRecipeWithIRFlags(VPDef::VPWidenIntrinsicSC, CallArguments, CI),
1595-
VPIRMetadata(CI), VectorIntrinsicID(VectorIntrinsicID), ResultTy(Ty),
1590+
VPIRMetadata(MD), VectorIntrinsicID(VectorIntrinsicID), ResultTy(Ty),
15961591
MayReadFromMemory(CI.mayReadFromMemory()),
15971592
MayWriteToMemory(CI.mayWriteToMemory()),
15981593
MayHaveSideEffects(CI.mayHaveSideEffects()) {}
@@ -1617,7 +1612,8 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
16171612
VPWidenIntrinsicRecipe *clone() override {
16181613
if (Value *CI = getUnderlyingValue())
16191614
return new VPWidenIntrinsicRecipe(*cast<CallInst>(CI), VectorIntrinsicID,
1620-
operands(), ResultTy, getDebugLoc());
1615+
operands(), ResultTy, *this,
1616+
getDebugLoc());
16211617
return new VPWidenIntrinsicRecipe(VectorIntrinsicID, operands(), ResultTy,
16221618
getDebugLoc());
16231619
}

llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "llvm/Analysis/ScalarEvolution.h"
2323
#include "llvm/IR/InstrTypes.h"
2424
#include "llvm/IR/MDBuilder.h"
25+
#include "llvm/Transforms/Utils/LoopVersioning.h"
2526

2627
#define DEBUG_TYPE "vplan"
2728

@@ -37,6 +38,9 @@ class PlainCFGBuilder {
3738
// Loop Info analysis.
3839
LoopInfo *LI;
3940

41+
// Loop versioning for alias metadata.
42+
LoopVersioning *LVer;
43+
4044
// Vectorization plan that we are working on.
4145
std::unique_ptr<VPlan> Plan;
4246

@@ -65,8 +69,8 @@ class PlainCFGBuilder {
6569
void createVPInstructionsForVPBB(VPBasicBlock *VPBB, BasicBlock *BB);
6670

6771
public:
68-
PlainCFGBuilder(Loop *Lp, LoopInfo *LI)
69-
: TheLoop(Lp), LI(LI), Plan(std::make_unique<VPlan>(Lp)) {}
72+
PlainCFGBuilder(Loop *Lp, LoopInfo *LI, LoopVersioning *LVer)
73+
: TheLoop(Lp), LI(LI), LVer(LVer), Plan(std::make_unique<VPlan>(Lp)) {}
7074

7175
/// Build plain CFG for TheLoop and connect it to Plan's entry.
7276
std::unique_ptr<VPlan> buildPlainCFG();
@@ -186,7 +190,8 @@ void PlainCFGBuilder::createVPInstructionsForVPBB(VPBasicBlock *VPBB,
186190
// recipes.
187191
if (Br->isConditional()) {
188192
VPValue *Cond = getOrCreateVPOperand(Br->getCondition());
189-
VPIRBuilder.createNaryOp(VPInstruction::BranchOnCond, {Cond}, Inst);
193+
VPIRBuilder.createNaryOp(VPInstruction::BranchOnCond, {Cond}, Inst,
194+
VPIRMetadata(*Inst), Inst->getDebugLoc());
190195
}
191196

192197
// Skip the rest of the Instruction processing for Branch instructions.
@@ -200,7 +205,8 @@ void PlainCFGBuilder::createVPInstructionsForVPBB(VPBasicBlock *VPBB,
200205
SmallVector<VPValue *> Ops = {getOrCreateVPOperand(SI->getCondition())};
201206
for (auto Case : SI->cases())
202207
Ops.push_back(getOrCreateVPOperand(Case.getCaseValue()));
203-
VPIRBuilder.createNaryOp(Instruction::Switch, Ops, Inst);
208+
VPIRBuilder.createNaryOp(Instruction::Switch, Ops, Inst,
209+
VPIRMetadata(*Inst), Inst->getDebugLoc());
204210
continue;
205211
}
206212

@@ -228,6 +234,18 @@ void PlainCFGBuilder::createVPInstructionsForVPBB(VPBasicBlock *VPBB,
228234
VPPredToIncomingValue.lookup(Pred->getExitingBasicBlock()));
229235
}
230236
} else {
237+
// Build VPIRMetadata from the instruction and add loop versioning
238+
// metadata for loads and stores.
239+
VPIRMetadata MD(*Inst);
240+
if (isa<LoadInst, StoreInst>(Inst) && LVer) {
241+
const auto &[AliasScopeMD, NoAliasMD] =
242+
LVer->getNoAliasMetadataFor(Inst);
243+
if (AliasScopeMD)
244+
MD.addMetadata(LLVMContext::MD_alias_scope, AliasScopeMD);
245+
if (NoAliasMD)
246+
MD.addMetadata(LLVMContext::MD_noalias, NoAliasMD);
247+
}
248+
231249
// Translate LLVM-IR operands into VPValue operands and set them in the
232250
// new VPInstruction.
233251
SmallVector<VPValue *, 4> VPOperands;
@@ -236,12 +254,12 @@ void PlainCFGBuilder::createVPInstructionsForVPBB(VPBasicBlock *VPBB,
236254

237255
if (auto *CI = dyn_cast<CastInst>(Inst)) {
238256
NewR = VPIRBuilder.createScalarCast(CI->getOpcode(), VPOperands[0],
239-
CI->getType(), CI->getDebugLoc());
257+
CI->getType(), CI->getDebugLoc(), {}, MD);
240258
NewR->setUnderlyingValue(CI);
241259
} else {
242260
// Build VPInstruction for any arbitrary Instruction without specific
243261
// representation in VPlan.
244-
NewR = VPIRBuilder.createNaryOp(Inst->getOpcode(), VPOperands, Inst);
262+
NewR = VPIRBuilder.createNaryOp(Inst->getOpcode(), VPOperands, Inst, MD, Inst->getDebugLoc());
245263
}
246264
}
247265

@@ -537,8 +555,9 @@ static void addInitialSkeleton(VPlan &Plan, Type *InductionTy, DebugLoc IVDL,
537555

538556
std::unique_ptr<VPlan>
539557
VPlanTransforms::buildVPlan0(Loop *TheLoop, LoopInfo &LI, Type *InductionTy,
540-
DebugLoc IVDL, PredicatedScalarEvolution &PSE) {
541-
PlainCFGBuilder Builder(TheLoop, &LI);
558+
DebugLoc IVDL, PredicatedScalarEvolution &PSE,
559+
LoopVersioning *LVer) {
560+
PlainCFGBuilder Builder(TheLoop, &LI, LVer);
542561
std::unique_ptr<VPlan> VPlan0 = Builder.buildPlainCFG();
543562
addInitialSkeleton(*VPlan0, InductionTy, IVDL, PSE, TheLoop);
544563
return VPlan0;

0 commit comments

Comments
 (0)