Skip to content

Commit d4f7995

Browse files
authored
[VPlan] Use Unknown instead of empty location in VPlanTransforms (#157702)
The default values for DebugLocs in LoopVectorizer/VPlan were recently updated from empty DebugLocs to DebugLoc::getUnknown, as part of the DebugLoc Coverage Tracking work. However, there are some cases where we also pass an explicit empty DebugLoc, in many cases as a filler argument. This patch updates all of these to `getUnknown` for now, until either valid locations or a suitable categorization can be assigned to each instead. This change is NFC outside of DebugLoc coverage tracking builds.
1 parent b965f26 commit d4f7995

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ static VPRegionBlock *createReplicateRegion(VPReplicateRecipe *PredRecipe,
349349
auto *BlockInMask = PredRecipe->getMask();
350350
auto *MaskDef = BlockInMask->getDefiningRecipe();
351351
auto *BOMRecipe = new VPBranchOnMaskRecipe(
352-
BlockInMask, MaskDef ? MaskDef->getDebugLoc() : DebugLoc());
352+
BlockInMask, MaskDef ? MaskDef->getDebugLoc() : DebugLoc::getUnknown());
353353
auto *Entry =
354354
Plan.createVPBasicBlock(Twine(RegionName) + ".entry", BOMRecipe);
355355

@@ -864,8 +864,8 @@ static VPValue *optimizeLatchExitInductionUser(
864864
Type *StepTy = TypeInfo.inferScalarType(Step);
865865
auto *Zero = Plan.getOrAddLiveIn(ConstantInt::get(StepTy, 0));
866866
return B.createPtrAdd(EndValue,
867-
B.createNaryOp(Instruction::Sub, {Zero, Step}), {},
868-
"ind.escape");
867+
B.createNaryOp(Instruction::Sub, {Zero, Step}),
868+
DebugLoc::getUnknown(), "ind.escape");
869869
}
870870
if (ScalarTy->isFloatingPointTy()) {
871871
const auto &ID = WideIV->getInductionDescriptor();
@@ -2312,7 +2312,8 @@ static VPActiveLaneMaskPHIRecipe *addVPLaneMaskPhiAndUpdateExitBranch(
23122312

23132313
// Now create the ActiveLaneMaskPhi recipe in the main loop using the
23142314
// preheader ActiveLaneMask instruction.
2315-
auto *LaneMaskPhi = new VPActiveLaneMaskPHIRecipe(EntryALM, DebugLoc());
2315+
auto *LaneMaskPhi =
2316+
new VPActiveLaneMaskPHIRecipe(EntryALM, DebugLoc::getUnknown());
23162317
LaneMaskPhi->insertAfter(CanonicalIVPHI);
23172318

23182319
// Create the active lane mask for the next iteration of the loop before the
@@ -2539,11 +2540,11 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
25392540
VPBuilder Builder(LoopRegion->getPreheaderVPBB());
25402541
MaxEVL = Builder.createScalarZExtOrTrunc(
25412542
MaxEVL, Type::getInt32Ty(Plan.getContext()),
2542-
TypeInfo.inferScalarType(MaxEVL), DebugLoc());
2543+
TypeInfo.inferScalarType(MaxEVL), DebugLoc::getUnknown());
25432544

25442545
Builder.setInsertPoint(Header, Header->getFirstNonPhi());
2545-
VPValue *PrevEVL =
2546-
Builder.createScalarPhi({MaxEVL, &EVL}, DebugLoc(), "prev.evl");
2546+
VPValue *PrevEVL = Builder.createScalarPhi(
2547+
{MaxEVL, &EVL}, DebugLoc::getUnknown(), "prev.evl");
25472548

25482549
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
25492550
vp_depth_first_deep(Plan.getVectorLoopRegion()->getEntry()))) {
@@ -2673,7 +2674,7 @@ void VPlanTransforms::addExplicitVectorLength(
26732674
VPValue *StartV = CanonicalIVPHI->getStartValue();
26742675

26752676
// Create the ExplicitVectorLengthPhi recipe in the main loop.
2676-
auto *EVLPhi = new VPEVLBasedIVPHIRecipe(StartV, DebugLoc());
2677+
auto *EVLPhi = new VPEVLBasedIVPHIRecipe(StartV, DebugLoc::getUnknown());
26772678
EVLPhi->insertAfter(CanonicalIVPHI);
26782679
VPBuilder Builder(Header, Header->getFirstNonPhi());
26792680
// Create the AVL (application vector length), starting from TC -> 0 in steps
@@ -2687,10 +2688,11 @@ void VPlanTransforms::addExplicitVectorLength(
26872688
VPValue *AVLSafe =
26882689
Plan.getOrAddLiveIn(ConstantInt::get(CanIVTy, *MaxSafeElements));
26892690
VPValue *Cmp = Builder.createICmp(ICmpInst::ICMP_ULT, AVL, AVLSafe);
2690-
AVL = Builder.createSelect(Cmp, AVL, AVLSafe, DebugLoc(), "safe_avl");
2691+
AVL = Builder.createSelect(Cmp, AVL, AVLSafe, DebugLoc::getUnknown(),
2692+
"safe_avl");
26912693
}
26922694
auto *VPEVL = Builder.createNaryOp(VPInstruction::ExplicitVectorLength, AVL,
2693-
DebugLoc());
2695+
DebugLoc::getUnknown());
26942696

26952697
auto *CanonicalIVIncrement =
26962698
cast<VPInstruction>(CanonicalIVPHI->getBackedgeValue());
@@ -3117,8 +3119,8 @@ expandVPWidenIntOrFpInduction(VPWidenIntOrFpInductionRecipe *WidenIVR,
31173119
VPValue *SplatStep = Builder.createNaryOp(VPInstruction::Broadcast, Step);
31183120

31193121
Init = Builder.createNaryOp(MulOp, {Init, SplatStep}, Flags);
3120-
Init =
3121-
Builder.createNaryOp(AddOp, {SplatStart, Init}, Flags, {}, "induction");
3122+
Init = Builder.createNaryOp(AddOp, {SplatStart, Init}, Flags,
3123+
DebugLoc::getUnknown(), "induction");
31223124

31233125
// Create the widened phi of the vector IV.
31243126
auto *WidePHI = new VPWidenPHIRecipe(WidenIVR->getPHINode(), nullptr,

0 commit comments

Comments
 (0)