[llvm] [VPlan] Make canonical IV part of the region (PR #156262)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 21 13:25:43 PDT 2025
================
@@ -406,13 +406,23 @@ static void createLoopRegion(VPlan &Plan, VPBlockBase *HeaderVPB) {
// LatchExitVPB, taking care to preserve the original predecessor & successor
// order of blocks. Set region entry and exiting after both HeaderVPB and
// LatchVPBB have been disconnected from their predecessors/successors.
- auto *R = Plan.createVPRegionBlock();
+ VPPhi *ScalarCanIV = nullptr;
+ if (PreheaderVPBB->getSinglePredecessor() == Plan.getEntry())
+ ScalarCanIV = cast<VPPhi>(&*cast<VPBasicBlock>(HeaderVPB)->begin());
+ auto *R = Plan.createVPRegionBlock(
+ ScalarCanIV->getOperand(0)->getLiveInIRValue()->getType(),
+ ScalarCanIV ? ScalarCanIV->getDebugLoc()
----------------
fhahn wrote:
We currently only create a canonical IV in the outermost loop. when vectorizing an inner loop, we won't have a scalar phi for the canonical induction. In that case, it won't be used currently.
https://github.com/llvm/llvm-project/pull/156262
More information about the llvm-commits
mailing list