Skip to content

Commit 42fb1fa

Browse files
committed
[VPlan] Use DebugLoc from recipe in VPWidenCallRecipe (NFCI).
Instead of using the debug location of the underlying instruction, use the debug location from the recipe. This removes an unneeded dependency of the underlying instruction.
1 parent 061eb62 commit 42fb1fa

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8261,7 +8261,8 @@ VPWidenCallRecipe *VPRecipeBuilder::tryToWidenCall(CallInst *CI,
82618261
},
82628262
Range);
82638263
if (ShouldUseVectorIntrinsic)
8264-
return new VPWidenCallRecipe(*CI, make_range(Ops.begin(), Ops.end()), ID);
8264+
return new VPWidenCallRecipe(*CI, make_range(Ops.begin(), Ops.end()), ID,
8265+
CI->getDebugLoc());
82658266

82668267
Function *Variant = nullptr;
82678268
std::optional<unsigned> MaskPos;
@@ -8314,7 +8315,8 @@ VPWidenCallRecipe *VPRecipeBuilder::tryToWidenCall(CallInst *CI,
83148315
}
83158316

83168317
return new VPWidenCallRecipe(*CI, make_range(Ops.begin(), Ops.end()),
8317-
Intrinsic::not_intrinsic, Variant);
8318+
Intrinsic::not_intrinsic, CI->getDebugLoc(),
8319+
Variant);
83188320
}
83198321

83208322
return nullptr;

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,9 +1352,9 @@ class VPWidenCallRecipe : public VPSingleDefRecipe {
13521352
public:
13531353
template <typename IterT>
13541354
VPWidenCallRecipe(CallInst &I, iterator_range<IterT> CallArguments,
1355-
Intrinsic::ID VectorIntrinsicID,
1355+
Intrinsic::ID VectorIntrinsicID, DebugLoc DL = {},
13561356
Function *Variant = nullptr)
1357-
: VPSingleDefRecipe(VPDef::VPWidenCallSC, CallArguments, &I),
1357+
: VPSingleDefRecipe(VPDef::VPWidenCallSC, CallArguments, &I, DL),
13581358
VectorIntrinsicID(VectorIntrinsicID), Variant(Variant) {}
13591359

13601360
~VPWidenCallRecipe() override = default;

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ void VPWidenCallRecipe::execute(VPTransformState &State) {
580580
auto &CI = *cast<CallInst>(getUnderlyingInstr());
581581
assert(!isa<DbgInfoIntrinsic>(CI) &&
582582
"DbgInfoIntrinsic should have been dropped during VPlan construction");
583-
State.setDebugLocFrom(CI.getDebugLoc());
583+
State.setDebugLocFrom(getDebugLoc());
584584

585585
bool UseIntrinsic = VectorIntrinsicID != Intrinsic::not_intrinsic;
586586
FunctionType *VFTy = nullptr;

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ void VPlanTransforms::VPInstructionsToVPRecipes(
7474
} else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Inst)) {
7575
NewRecipe = new VPWidenGEPRecipe(GEP, Ingredient.operands());
7676
} else if (CallInst *CI = dyn_cast<CallInst>(Inst)) {
77-
NewRecipe =
78-
new VPWidenCallRecipe(*CI, drop_end(Ingredient.operands()),
79-
getVectorIntrinsicIDForCall(CI, &TLI));
77+
NewRecipe = new VPWidenCallRecipe(
78+
*CI, drop_end(Ingredient.operands()),
79+
getVectorIntrinsicIDForCall(CI, &TLI), CI->getDebugLoc());
8080
} else if (SelectInst *SI = dyn_cast<SelectInst>(Inst)) {
8181
NewRecipe = new VPWidenSelectRecipe(*SI, Ingredient.operands());
8282
} else if (auto *CI = dyn_cast<CastInst>(Inst)) {

0 commit comments

Comments
 (0)