[llvm] [VPlan] Make canonical IV part of the region (PR #156262)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 22 13:22:16 PDT 2026
================
@@ -1230,19 +1258,40 @@ VPlan *VPlan::duplicate() {
DenseMap<VPValue *, VPValue *> Old2NewVPValues;
for (VPIRValue *OldLiveIn : getLiveIns())
Old2NewVPValues[OldLiveIn] = NewPlan->getOrAddLiveIn(OldLiveIn);
- Old2NewVPValues[&VectorTripCount] = &NewPlan->VectorTripCount;
- Old2NewVPValues[&VF] = &NewPlan->VF;
- Old2NewVPValues[&UF] = &NewPlan->UF;
- Old2NewVPValues[&VFxUF] = &NewPlan->VFxUF;
- if (BackedgeTakenCount) {
- NewPlan->BackedgeTakenCount = new VPSymbolicValue();
- Old2NewVPValues[BackedgeTakenCount] = NewPlan->BackedgeTakenCount;
- }
+
if (auto *TripCountIRV = dyn_cast_or_null<VPIRValue>(TripCount))
Old2NewVPValues[TripCountIRV] = NewPlan->getOrAddLiveIn(TripCountIRV);
// else NewTripCount will be created and inserted into Old2NewVPValues when
// TripCount is cloned. In any case NewPlan->TripCount is updated below.
+ if (auto *LoopRegion = getVectorLoopRegion()) {
+ auto *OldCanIV = LoopRegion->getCanonicalIV();
+ auto *NewCanIV = NewPlan->getVectorLoopRegion()->getCanonicalIV();
+ assert(OldCanIV && NewCanIV &&
+ "Loop regions of both plans must have canonical IVs.");
+ Old2NewVPValues[OldCanIV] = NewCanIV;
+ }
+
+ assert(none_of(Old2NewVPValues.keys(), IsaPred<VPSymbolicValue>) &&
+ "All VPSymbolicValues must be handled below");
+
+ // Map and propagate materialized state for symbolic values.
----------------
fhahn wrote:
Updated to create first, then handle below, thanks
https://github.com/llvm/llvm-project/pull/156262
More information about the llvm-commits
mailing list