Skip to content

Commit 66494c2

Browse files
committed
[NFC] Use Unknown instead of empty location in VPlanTransforms
The default values for DebugLocs in LoopVectorizer/VPlan were recently updated from empty DebugLocs to DebugLoc::getUnknown, as part of the Debug Loc Coverage Tracking work. However, there are some cases where we also pass an explicit empty DebugLoc, in some cases intentionally, and in others as a filler argument. This patch updates all of these to `getUnknown` for now, until a more principled approach to debug location propagation in the vectorizers is implemented.
1 parent 3b19717 commit 66494c2

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();
@@ -2307,7 +2307,8 @@ static VPActiveLaneMaskPHIRecipe *addVPLaneMaskPhiAndUpdateExitBranch(
23072307

23082308
// Now create the ActiveLaneMaskPhi recipe in the main loop using the
23092309
// preheader ActiveLaneMask instruction.
2310-
auto *LaneMaskPhi = new VPActiveLaneMaskPHIRecipe(EntryALM, DebugLoc());
2310+
auto *LaneMaskPhi =
2311+
new VPActiveLaneMaskPHIRecipe(EntryALM, DebugLoc::getUnknown());
23112312
LaneMaskPhi->insertAfter(CanonicalIVPHI);
23122313

23132314
// Create the active lane mask for the next iteration of the loop before the
@@ -2534,11 +2535,11 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
25342535
VPBuilder Builder(LoopRegion->getPreheaderVPBB());
25352536
MaxEVL = Builder.createScalarZExtOrTrunc(
25362537
MaxEVL, Type::getInt32Ty(Plan.getContext()),
2537-
TypeInfo.inferScalarType(MaxEVL), DebugLoc());
2538+
TypeInfo.inferScalarType(MaxEVL), DebugLoc::getUnknown());
25382539

25392540
Builder.setInsertPoint(Header, Header->getFirstNonPhi());
2540-
VPValue *PrevEVL =
2541-
Builder.createScalarPhi({MaxEVL, &EVL}, DebugLoc(), "prev.evl");
2541+
VPValue *PrevEVL = Builder.createScalarPhi(
2542+
{MaxEVL, &EVL}, DebugLoc::getUnknown(), "prev.evl");
25422543

25432544
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
25442545
vp_depth_first_deep(Plan.getVectorLoopRegion()->getEntry()))) {
@@ -2668,7 +2669,7 @@ void VPlanTransforms::addExplicitVectorLength(
26682669
VPValue *StartV = CanonicalIVPHI->getStartValue();
26692670

26702671
// Create the ExplicitVectorLengthPhi recipe in the main loop.
2671-
auto *EVLPhi = new VPEVLBasedIVPHIRecipe(StartV, DebugLoc());
2672+
auto *EVLPhi = new VPEVLBasedIVPHIRecipe(StartV, DebugLoc::getUnknown());
26722673
EVLPhi->insertAfter(CanonicalIVPHI);
26732674
VPBuilder Builder(Header, Header->getFirstNonPhi());
26742675
// Create the AVL (application vector length), starting from TC -> 0 in steps
@@ -2682,10 +2683,11 @@ void VPlanTransforms::addExplicitVectorLength(
26822683
VPValue *AVLSafe =
26832684
Plan.getOrAddLiveIn(ConstantInt::get(CanIVTy, *MaxSafeElements));
26842685
VPValue *Cmp = Builder.createICmp(ICmpInst::ICMP_ULT, AVL, AVLSafe);
2685-
AVL = Builder.createSelect(Cmp, AVL, AVLSafe, DebugLoc(), "safe_avl");
2686+
AVL = Builder.createSelect(Cmp, AVL, AVLSafe, DebugLoc::getUnknown(),
2687+
"safe_avl");
26862688
}
26872689
auto *VPEVL = Builder.createNaryOp(VPInstruction::ExplicitVectorLength, AVL,
2688-
DebugLoc());
2690+
DebugLoc::getUnknown());
26892691

26902692
auto *CanonicalIVIncrement =
26912693
cast<VPInstruction>(CanonicalIVPHI->getBackedgeValue());
@@ -3112,8 +3114,8 @@ expandVPWidenIntOrFpInduction(VPWidenIntOrFpInductionRecipe *WidenIVR,
31123114
VPValue *SplatStep = Builder.createNaryOp(VPInstruction::Broadcast, Step);
31133115

31143116
Init = Builder.createNaryOp(MulOp, {Init, SplatStep}, Flags);
3115-
Init =
3116-
Builder.createNaryOp(AddOp, {SplatStart, Init}, Flags, {}, "induction");
3117+
Init = Builder.createNaryOp(AddOp, {SplatStart, Init}, Flags,
3118+
DebugLoc::getUnknown(), "induction");
31173119

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

0 commit comments

Comments
 (0)