Skip to content

Commit 89483ac

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 67c8e38 commit 89483ac

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
}
@@ -212,7 +213,7 @@ class VPBuilder {
212213
DebugLoc DL = DebugLoc::getUnknown(),
213214
const Twine &Name = "") {
214215
return tryInsertInstruction(
215-
new VPInstruction(VPInstruction::LogicalAnd, {LHS, RHS}, DL, Name));
216+
new VPInstruction(VPInstruction::LogicalAnd, {LHS, RHS}, {}, DL, Name));
216217
}
217218

218219
VPInstruction *
@@ -223,7 +224,7 @@ class VPBuilder {
223224
FMFs ? new VPInstruction(Instruction::Select, {Cond, TrueVal, FalseVal},
224225
*FMFs, {}, DL, Name)
225226
: new VPInstruction(Instruction::Select, {Cond, TrueVal, FalseVal},
226-
DL, Name);
227+
{}, DL, Name);
227228
return tryInsertInstruction(Select);
228229
}
229230

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

335336
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
@@ -7742,7 +7741,7 @@ VPSingleDefRecipe *VPRecipeBuilder::tryToWidenCall(VPInstruction *VPI,
77427741
},
77437742
Range);
77447743
if (ShouldUseVectorIntrinsic)
7745-
return new VPWidenIntrinsicRecipe(*CI, ID, Ops, CI->getType(),
7744+
return new VPWidenIntrinsicRecipe(*CI, ID, Ops, CI->getType(), *VPI,
77467745
VPI->getDebugLoc());
77477746

77487747
Function *Variant = nullptr;
@@ -7834,7 +7833,7 @@ VPWidenRecipe *VPRecipeBuilder::tryToWiden(VPInstruction *VPI) {
78347833
auto *SafeRHS =
78357834
Builder.createSelect(Mask, Ops[1], One, VPI->getDebugLoc());
78367835
Ops[1] = SafeRHS;
7837-
return new VPWidenRecipe(*I, Ops);
7836+
return new VPWidenRecipe(*I, Ops, *VPI, VPI->getDebugLoc());
78387837
}
78397838
[[fallthrough]];
78407839
}
@@ -7880,15 +7879,15 @@ VPWidenRecipe *VPRecipeBuilder::tryToWiden(VPInstruction *VPI) {
78807879
// For other binops, the legacy cost model only checks the second operand.
78817880
NewOps[1] = GetConstantViaSCEV(NewOps[1]);
78827881
}
7883-
return new VPWidenRecipe(*I, NewOps);
7882+
return new VPWidenRecipe(*I, NewOps, *VPI, VPI->getDebugLoc());
78847883
}
78857884
case Instruction::ExtractValue: {
78867885
SmallVector<VPValue *> NewOps(VPI->operands());
78877886
auto *EVI = cast<ExtractValueInst>(I);
78887887
assert(EVI->getNumIndices() == 1 && "Expected one extractvalue index");
78897888
unsigned Idx = EVI->getIndices()[0];
78907889
NewOps.push_back(Plan.getConstantInt(32, Idx));
7891-
return new VPWidenRecipe(*I, NewOps);
7890+
return new VPWidenRecipe(*I, NewOps, *VPI, VPI->getDebugLoc());
78927891
}
78937892
};
78947893
}
@@ -7972,8 +7971,8 @@ VPReplicateRecipe *VPRecipeBuilder::handleReplication(VPInstruction *VPI,
79727971
assert((Range.Start.isScalar() || !IsUniform || !IsPredicated ||
79737972
(Range.Start.isScalable() && isa<IntrinsicInst>(I))) &&
79747973
"Should not predicate a uniform recipe");
7975-
auto *Recipe = new VPReplicateRecipe(I, VPI->operands(), IsUniform,
7976-
BlockInMask, VPIRMetadata(*I, LVer));
7974+
auto *Recipe =
7975+
new VPReplicateRecipe(I, VPI->operands(), IsUniform, BlockInMask, *VPI);
79777976
return Recipe;
79787977
}
79797978

@@ -8232,7 +8231,7 @@ VPRecipeBase *VPRecipeBuilder::tryToCreateWidenRecipe(VPSingleDefRecipe *R,
82328231
auto *CastR = cast<VPInstructionWithType>(R);
82338232
auto *CI = cast<CastInst>(Instr);
82348233
return new VPWidenCastRecipe(CI->getOpcode(), VPI->getOperand(0),
8235-
CastR->getResultType(), *CI);
8234+
CastR->getResultType(), CI, *VPI, *VPI);
82368235
}
82378236

82388237
return tryToWiden(VPI);
@@ -8260,7 +8259,8 @@ VPRecipeBuilder::tryToCreatePartialReduction(VPInstruction *Reduction,
82608259
SmallVector<VPValue *, 2> Ops;
82618260
Ops.push_back(Plan.getOrAddLiveIn(Zero));
82628261
Ops.push_back(BinOp);
8263-
BinOp = new VPWidenRecipe(*ReductionI, Ops);
8262+
BinOp = new VPWidenRecipe(*ReductionI, Ops, VPIRMetadata(),
8263+
ReductionI->getDebugLoc());
82648264
Builder.insert(BinOp->getDefiningRecipe());
82658265
ReductionOpcode = Instruction::Add;
82668266
}
@@ -8293,7 +8293,7 @@ void LoopVectorizationPlanner::buildVPlansWithVPRecipes(ElementCount MinVF,
82938293
// candidates built later for specific VF ranges.
82948294
auto VPlan0 = VPlanTransforms::buildVPlan0(
82958295
OrigLoop, *LI, Legal->getWidestInductionType(),
8296-
getDebugLocFromInstOrOperands(Legal->getPrimaryInduction()), PSE);
8296+
getDebugLocFromInstOrOperands(Legal->getPrimaryInduction()), PSE, &LVer);
82978297

82988298
auto MaxVFTimes2 = MaxVF * 2;
82998299
for (ElementCount VF = MinVF; ElementCount::isKnownLT(VF, MaxVFTimes2);) {
@@ -8399,7 +8399,7 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(
83998399
// VPInstructions in the loop.
84008400
// ---------------------------------------------------------------------------
84018401
VPRecipeBuilder RecipeBuilder(*Plan, OrigLoop, TLI, &TTI, Legal, CM, PSE,
8402-
Builder, BlockMaskCache, LVer);
8402+
Builder, BlockMaskCache);
84038403
// TODO: Handle partial reductions with EVL tail folding.
84048404
if (!CM.foldTailWithEVL())
84058405
RecipeBuilder.collectScaledReductions(Range);
@@ -8444,9 +8444,9 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(
84448444
Legal->isInvariantAddressOfReduction(SI->getPointerOperand())) {
84458445
// Only create recipe for the final invariant store of the reduction.
84468446
if (Legal->isInvariantStoreOfReduction(SI)) {
8447-
auto *Recipe =
8448-
new VPReplicateRecipe(SI, R.operands(), true /* IsUniform */,
8449-
nullptr /*Mask*/, VPIRMetadata(*SI, LVer));
8447+
auto *Recipe = new VPReplicateRecipe(
8448+
SI, R.operands(), true /* IsUniform */, nullptr /*Mask*/,
8449+
*cast<VPInstruction>(SingleDef));
84508450
Recipe->insertBefore(*MiddleVPBB, MBIP);
84518451
}
84528452
R.eraseFromParent();
@@ -8597,7 +8597,7 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlan(VFRange &Range) {
85978597
// addScalarResumePhis.
85988598
DenseMap<VPBasicBlock *, VPValue *> BlockMaskCache;
85998599
VPRecipeBuilder RecipeBuilder(*Plan, OrigLoop, TLI, &TTI, Legal, CM, PSE,
8600-
Builder, BlockMaskCache, nullptr /*LVer*/);
8600+
Builder, BlockMaskCache);
86018601
for (auto &R : Plan->getVectorLoopRegion()->getEntryBasicBlock()->phis()) {
86028602
if (isa<VPCanonicalIVPHIRecipe>(&R))
86038603
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
@@ -1103,10 +1103,6 @@ class LLVM_ABI_FOR_TEST VPInstruction : public VPRecipeWithIRFlags,
11031103
#endif
11041104

11051105
public:
1106-
VPInstruction(unsigned Opcode, ArrayRef<VPValue *> Operands,
1107-
DebugLoc DL = DebugLoc::getUnknown(), const Twine &Name = "")
1108-
: VPInstruction(Opcode, Operands, {}, {}, DL, Name) {}
1109-
11101106
VPInstruction(unsigned Opcode, ArrayRef<VPValue *> Operands,
11111107
const VPIRFlags &Flags, const VPIRMetadata &MD = {},
11121108
DebugLoc DL = DebugLoc::getUnknown(), const Twine &Name = "");
@@ -1314,7 +1310,7 @@ class VPPhiAccessors {
13141310

13151311
struct LLVM_ABI_FOR_TEST VPPhi : public VPInstruction, public VPPhiAccessors {
13161312
VPPhi(ArrayRef<VPValue *> Operands, DebugLoc DL, const Twine &Name = "")
1317-
: VPInstruction(Instruction::PHI, Operands, DL, Name) {}
1313+
: VPInstruction(Instruction::PHI, Operands, {}, DL, Name) {}
13181314

13191315
static inline bool classof(const VPUser *U) {
13201316
auto *VPI = dyn_cast<VPInstruction>(U);
@@ -1457,9 +1453,12 @@ class LLVM_ABI_FOR_TEST VPWidenRecipe : public VPRecipeWithIRFlags,
14571453
: VPRecipeWithIRFlags(VPDef::VPWidenSC, Operands, Flags, DL),
14581454
VPIRMetadata(Metadata), Opcode(Opcode) {}
14591455

1460-
VPWidenRecipe(Instruction &I, ArrayRef<VPValue *> Operands)
1461-
: VPRecipeWithIRFlags(VPDef::VPWidenSC, Operands, I), VPIRMetadata(I),
1462-
Opcode(I.getOpcode()) {}
1456+
VPWidenRecipe(Instruction &I, ArrayRef<VPValue *> Operands,
1457+
const VPIRMetadata &Metadata, DebugLoc DL)
1458+
: VPRecipeWithIRFlags(VPDef::VPWidenSC, Operands, VPIRFlags(I), DL),
1459+
VPIRMetadata(Metadata), Opcode(I.getOpcode()) {
1460+
setUnderlyingValue(&I);
1461+
}
14631462

14641463
~VPWidenRecipe() override = default;
14651464

@@ -1499,31 +1498,26 @@ class VPWidenCastRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
14991498

15001499
public:
15011500
VPWidenCastRecipe(Instruction::CastOps Opcode, VPValue *Op, Type *ResultTy,
1502-
CastInst &UI)
1503-
: VPRecipeWithIRFlags(VPDef::VPWidenCastSC, Op, UI), VPIRMetadata(UI),
1504-
Opcode(Opcode), ResultTy(ResultTy) {
1505-
assert(UI.getOpcode() == Opcode &&
1506-
"opcode of underlying cast doesn't match");
1507-
}
1508-
1509-
VPWidenCastRecipe(Instruction::CastOps Opcode, VPValue *Op, Type *ResultTy,
1510-
const VPIRFlags &Flags = {},
1501+
CastInst *UI = nullptr, const VPIRFlags &Flags = {},
15111502
const VPIRMetadata &Metadata = {},
15121503
DebugLoc DL = DebugLoc::getUnknown())
1513-
: VPRecipeWithIRFlags(VPDef::VPWidenCastSC, Op, Flags, DL),
1504+
: VPRecipeWithIRFlags(VPDef::VPWidenCastSC, Op,
1505+
UI ? VPIRFlags(*UI) : Flags,
1506+
UI ? UI->getDebugLoc() : DL),
15141507
VPIRMetadata(Metadata), Opcode(Opcode), ResultTy(ResultTy) {
15151508
assert(flagsValidForOpcode(Opcode) &&
15161509
"Set flags not supported for the provided opcode");
1510+
assert((!UI || UI->getOpcode() == Opcode) &&
1511+
"opcode of underlying cast doesn't match");
1512+
setUnderlyingValue(UI);
15171513
}
15181514

15191515
~VPWidenCastRecipe() override = default;
15201516

15211517
VPWidenCastRecipe *clone() override {
1522-
auto *New = new VPWidenCastRecipe(Opcode, getOperand(0), ResultTy, *this,
1523-
*this, getDebugLoc());
1524-
if (auto *UV = getUnderlyingValue())
1525-
New->setUnderlyingValue(UV);
1526-
return New;
1518+
return new VPWidenCastRecipe(Opcode, getOperand(0), ResultTy,
1519+
cast_or_null<CastInst>(getUnderlyingValue()),
1520+
*this, *this, getDebugLoc());
15271521
}
15281522

15291523
VP_CLASSOF_IMPL(VPDef::VPWidenCastSC)
@@ -1567,9 +1561,10 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
15671561
public:
15681562
VPWidenIntrinsicRecipe(CallInst &CI, Intrinsic::ID VectorIntrinsicID,
15691563
ArrayRef<VPValue *> CallArguments, Type *Ty,
1564+
const VPIRMetadata &MD = {},
15701565
DebugLoc DL = DebugLoc::getUnknown())
15711566
: VPRecipeWithIRFlags(VPDef::VPWidenIntrinsicSC, CallArguments, CI),
1572-
VPIRMetadata(CI), VectorIntrinsicID(VectorIntrinsicID), ResultTy(Ty),
1567+
VPIRMetadata(MD), VectorIntrinsicID(VectorIntrinsicID), ResultTy(Ty),
15731568
MayReadFromMemory(CI.mayReadFromMemory()),
15741569
MayWriteToMemory(CI.mayWriteToMemory()),
15751570
MayHaveSideEffects(CI.mayHaveSideEffects()) {}
@@ -1594,7 +1589,8 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
15941589
VPWidenIntrinsicRecipe *clone() override {
15951590
if (Value *CI = getUnderlyingValue())
15961591
return new VPWidenIntrinsicRecipe(*cast<CallInst>(CI), VectorIntrinsicID,
1597-
operands(), ResultTy, getDebugLoc());
1592+
operands(), ResultTy, *this,
1593+
getDebugLoc());
15981594
return new VPWidenIntrinsicRecipe(VectorIntrinsicID, operands(), ResultTy,
15991595
getDebugLoc());
16001596
}

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)