[VPlan] Manage VPWidenPointerInduction debug location via recipe.

Update VPWidenPointerInduction to manage its debug location via recipe.
This makes sure we emit a proper debug location for
VPWidenPointerInductionRecipes.
This commit is contained in:
Florian Hahn 2024-12-15 14:41:07 +00:00
parent 6c98f70b30
commit 2067e604a4
No known key found for this signature in database
GPG Key ID: 9E54DEA47A8F4434
4 changed files with 11 additions and 6 deletions

View File

@ -8466,7 +8466,8 @@ VPHeaderPHIRecipe *VPRecipeBuilder::tryToOptimizeInductionPHI(
[&](ElementCount VF) {
return CM.isScalarAfterVectorization(Phi, VF);
},
Range));
Range),
Phi->getDebugLoc());
}
return nullptr;
}

View File

@ -2211,8 +2211,8 @@ public:
/// Start.
VPWidenPointerInductionRecipe(PHINode *Phi, VPValue *Start, VPValue *Step,
const InductionDescriptor &IndDesc,
bool IsScalarAfterVectorization)
: VPHeaderPHIRecipe(VPDef::VPWidenPointerInductionSC, Phi),
bool IsScalarAfterVectorization, DebugLoc DL)
: VPHeaderPHIRecipe(VPDef::VPWidenPointerInductionSC, Phi, nullptr, DL),
IndDesc(IndDesc),
IsScalarAfterVectorization(IsScalarAfterVectorization) {
addOperand(Start);
@ -2224,7 +2224,7 @@ public:
VPWidenPointerInductionRecipe *clone() override {
return new VPWidenPointerInductionRecipe(
cast<PHINode>(getUnderlyingInstr()), getOperand(0), getOperand(1),
IndDesc, IsScalarAfterVectorization);
IndDesc, IsScalarAfterVectorization, getDebugLoc());
}
VP_CLASSOF_IMPL(VPDef::VPWidenPointerInductionSC)

View File

@ -3182,6 +3182,7 @@ void VPWidenPointerInductionRecipe::execute(VPTransformState &State) {
NewPointerPhi = PHINode::Create(ScStValueType, 2, "pointer.phi",
CanonicalIV->getIterator());
NewPointerPhi->addIncoming(ScalarStartValue, VectorPH);
NewPointerPhi->setDebugLoc(getDebugLoc());
} else {
// The recipe has been unrolled. In that case, fetch the single pointer phi
// shared among all unrolled parts of the recipe.

View File

@ -31,13 +31,15 @@ for.end: ; preds = %for.body
ret void
}
; FIXME: Missing debug location for pointer induction in vector loop
define void @widen_ptr_induction_dbg(ptr %start, ptr %end) {
; DEBUGLOC-LABEL: define void @widen_ptr_induction_dbg(
; DEBUGLOC: vector.body:
; DEBUGLOC-NOT: = phi ptr {{.+}}, !dbg
; DEBUGLOC-NEXT: = phi ptr {{.+}}, !dbg ![[PTRIVLOC:[0-9]+]]
; DEBUGLOC: = phi i64
;
; DEBUGLOC: loop:
; DEBUGLOC-NEXT: = phi ptr {{.+}}, !dbg ![[PTRIVLOC]]
;
entry:
br label %loop
@ -59,3 +61,4 @@ exit:
; CHECK: !{!"llvm.loop.isvectorized", i32 1}
; DEBUGLOC: ![[RESUMELOC]] = !DILocation(line: 2
; DEBUGLOC: ![[PTRIVLOC]] = !DILocation(line: 12