@@ -1710,9 +1710,8 @@ static bool simplifyBranchConditionForVFAndUF(VPlan &Plan, ElementCount BestVF,
17101710 HeaderR.getVPSingleValue ()->replaceAllUsesWith (Phi->getIncomingValue (0 ));
17111711 HeaderR.eraseFromParent ();
17121712 }
1713- Plan.getCanonicalIV ()->replaceAllUsesWith (
1714- Plan.getOrAddLiveIn (ConstantInt::getNullValue (
1715- VPTypeAnalysis (Plan).inferScalarType (Plan.getCanonicalIV ()))));
1713+ VectorRegion->getCanonicalIV ()->replaceAllUsesWith (Plan.getOrAddLiveIn (
1714+ ConstantInt::getNullValue (VectorRegion->getCanonicalIVType ())));
17161715
17171716 VPBlockBase *Preheader = VectorRegion->getSinglePredecessor ();
17181717 VPBlockBase *Exit = VectorRegion->getSingleSuccessor ();
@@ -2319,16 +2318,15 @@ static VPActiveLaneMaskPHIRecipe *addVPLaneMaskPhiAndUpdateExitBranch(
23192318 VPlan &Plan, bool DataAndControlFlowWithoutRuntimeCheck) {
23202319 VPRegionBlock *TopRegion = Plan.getVectorLoopRegion ();
23212320 VPBasicBlock *EB = TopRegion->getExitingBasicBlock ();
2322- VPValue *CanonicalIV = Plan.getCanonicalIV ();
2323- VPValue *StartV = Plan. getOrAddLiveIn ( Constant::getNullValue (
2324- VPTypeAnalysis ( Plan). inferScalarType (CanonicalIV) ));
2321+ auto &CanIVInfo = Plan.getCanonicalIVInfo ();
2322+ VPValue *CanonicalIV = CanIVInfo. CanIV ;
2323+ VPValue *StartV = Plan. getOrAddLiveIn ( Constant::getNullValue (CanIVInfo. Ty ));
23252324
23262325 auto *CanonicalIVIncrement =
23272326 cast<VPInstruction>(EB->getTerminator ()->getOperand (0 ));
23282327 // TODO: Check if dropping the flags is needed if
23292328 // !DataAndControlFlowWithoutRuntimeCheck.
23302329 CanonicalIVIncrement->dropPoisonGeneratingFlags ();
2331- auto &CanIVInfo = Plan.getCanonicalIVInfo ();
23322330 CanIVInfo.HasNUW = false ;
23332331 DebugLoc DL = CanIVInfo.DL ;
23342332 // We can't use StartV directly in the ActiveLaneMask VPInstruction, since
@@ -2360,8 +2358,8 @@ static VPActiveLaneMaskPHIRecipe *addVPLaneMaskPhiAndUpdateExitBranch(
23602358 " index.part.next" );
23612359
23622360 // Create the active lane mask instruction in the VPlan preheader.
2363- VPValue *ALMMultiplier = Plan. getOrAddLiveIn (
2364- ConstantInt::get (VPTypeAnalysis (Plan). inferScalarType (CanonicalIV) , 1 ));
2361+ VPValue *ALMMultiplier =
2362+ Plan. getOrAddLiveIn ( ConstantInt::get (CanIVInfo. Ty , 1 ));
23652363 auto *EntryALM = Builder.createNaryOp (VPInstruction::ActiveLaneMask,
23662364 {EntryIncrement, TC, ALMMultiplier}, DL,
23672365 " active.lane.mask.entry" );
@@ -2458,8 +2456,8 @@ void VPlanTransforms::addActiveLaneMask(
24582456 Plan, DataAndControlFlowWithoutRuntimeCheck);
24592457 } else {
24602458 VPBuilder B = VPBuilder::getToInsertAfter (WideCanonicalIV);
2461- VPValue *ALMMultiplier = Plan. getOrAddLiveIn ( ConstantInt::get (
2462- VPTypeAnalysis ( Plan). inferScalarType ( Plan.getCanonicalIV ()) , 1 ));
2459+ VPValue *ALMMultiplier =
2460+ Plan. getOrAddLiveIn ( ConstantInt::get ( Plan.getCanonicalIVInfo (). Ty , 1 ));
24632461 LaneMask =
24642462 B.createNaryOp (VPInstruction::ActiveLaneMask,
24652463 {WideCanonicalIV, Plan.getTripCount (), ALMMultiplier},
@@ -2730,7 +2728,7 @@ void VPlanTransforms::addExplicitVectorLength(
27302728
27312729 auto *CanonicalIV = Plan.getCanonicalIV ();
27322730 auto &CanIVInfo = Plan.getCanonicalIVInfo ();
2733- auto *CanIVTy = VPTypeAnalysis (Plan). inferScalarType (CanonicalIV) ;
2731+ auto *CanIVTy = CanIVInfo. Ty ;
27342732 VPValue *StartV = Plan.getOrAddLiveIn (ConstantInt::getNullValue (CanIVTy));
27352733 auto *CanonicalIVIncrement = cast<VPInstruction>(Plan.getVectorLoopRegion ()
27362734 ->getExitingBasicBlock ()
@@ -4174,8 +4172,7 @@ void VPlanTransforms::narrowInterleaveGroups(VPlan &Plan, ElementCount VF,
41744172
41754173 // Adjust induction to reflect that the transformed plan only processes one
41764174 // original iteration.
4177- auto *CanIV = Plan.getCanonicalIV ();
4178- Type *CanIVTy = TypeInfo.inferScalarType (CanIV);
4175+ Type *CanIVTy = Plan.getCanonicalIVInfo ().Ty ;
41794176 auto *Inc = cast<VPInstruction>(
41804177 VectorLoop->getExitingBasicBlock ()->getTerminator ()->getOperand (0 ));
41814178 VPBuilder PHBuilder (Plan.getVectorPreheader ());
0 commit comments