diff options
| author | Florian Hahn <flo@fhahn.com> | 2025-07-26 21:45:24 +0100 |
|---|---|---|
| committer | Florian Hahn <flo@fhahn.com> | 2025-07-26 21:45:25 +0100 |
| commit | 82e4b8332800f5e737cb16923848c768e3f1dccf (patch) | |
| tree | a95263a5b68853e005280e300158e796c30646c7 /llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp | |
| parent | b60aed6fbabc291a7afbcb460453f9dcdce76f34 (diff) | |
[VPlan] Use terminator debug loc for latch BranchOnCond.
Update VPlan to consistently use the latch branch debug location for the
latch branch in the vector loop, if there is one.
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp b/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp index 194874af547e..5319b8c4d8c4 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp @@ -437,9 +437,12 @@ static void addCanonicalIVRecipes(VPlan &Plan, VPBasicBlock *HeaderVPBB, // We are about to replace the branch to exit the region. Remove the original // BranchOnCond, if there is any. + DebugLoc LatchDL = DL; if (!LatchVPBB->empty() && - match(&LatchVPBB->back(), m_BranchOnCond(m_VPValue()))) + match(&LatchVPBB->back(), m_BranchOnCond(m_VPValue()))) { + LatchDL = LatchVPBB->getTerminator()->getDebugLoc(); LatchVPBB->getTerminator()->eraseFromParent(); + } VPBuilder Builder(LatchVPBB); // Add a VPInstruction to increment the scalar canonical IV by VF * UF. @@ -452,7 +455,8 @@ static void addCanonicalIVRecipes(VPlan &Plan, VPBasicBlock *HeaderVPBB, // Add the BranchOnCount VPInstruction to the latch. Builder.createNaryOp(VPInstruction::BranchOnCount, - {CanonicalIVIncrement, &Plan.getVectorTripCount()}, DL); + {CanonicalIVIncrement, &Plan.getVectorTripCount()}, + LatchDL); } void VPlanTransforms::prepareForVectorization( |
