@@ -802,7 +802,7 @@ static VPValue *optimizeEarlyExitInductionUser(VPlan &Plan,
802802  //  Calculate the final index.
803803  VPRegionBlock *LoopRegion = Plan.getVectorLoopRegion ();
804804  auto  *CanonicalIV = LoopRegion->getCanonicalIV ();
805-   Type *CanonicalIVType = CanonicalIV-> getScalarType ();
805+   Type *CanonicalIVType = LoopRegion-> getCanonicalIVType ();
806806  VPBuilder B (cast<VPBasicBlock>(PredVPBB));
807807
808808  DebugLoc DL = cast<VPInstruction>(Op)->getDebugLoc ();
@@ -2382,8 +2382,8 @@ static VPActiveLaneMaskPHIRecipe *addVPLaneMaskPhiAndUpdateExitBranch(
23822382      " index.part.next"  );
23832383
23842384  //  Create the active lane mask instruction in the VPlan preheader.
2385-   VPValue *ALMMultiplier = Plan. getOrAddLiveIn ( 
2386-       ConstantInt::get (TopRegion->getCanonicalIV ()-> getScalarType (), 1 ));
2385+   VPValue *ALMMultiplier =
2386+       Plan. getOrAddLiveIn ( ConstantInt::get (TopRegion->getCanonicalIVType (), 1 ));
23872387  auto  *EntryALM = Builder.createNaryOp (VPInstruction::ActiveLaneMask,
23882388                                        {EntryIncrement, TC, ALMMultiplier}, DL,
23892389                                        " active.lane.mask.entry"  );
@@ -2469,8 +2469,9 @@ void VPlanTransforms::addActiveLaneMask(
24692469         " UseActiveLaneMaskForControlFlow"  );
24702470
24712471  VPRegionBlock *LoopRegion = Plan.getVectorLoopRegion ();
2472-   auto  *FoundWidenCanonicalIVUser = find_if (
2473-       LoopRegion->getCanonicalIV ()->users (), IsaPred<VPWidenCanonicalIVRecipe>);
2472+   auto  *CanonicalIV = LoopRegion->getCanonicalIV ();
2473+   auto  *FoundWidenCanonicalIVUser =
2474+       find_if (CanonicalIV->users (), IsaPred<VPWidenCanonicalIVRecipe>);
24742475  assert (FoundWidenCanonicalIVUser &&
24752476         " Must have widened canonical IV when tail folding!"  );
24762477  VPSingleDefRecipe *HeaderMask = findHeaderMask (Plan);
@@ -2483,7 +2484,7 @@ void VPlanTransforms::addActiveLaneMask(
24832484  } else  {
24842485    VPBuilder B = VPBuilder::getToInsertAfter (WideCanonicalIV);
24852486    VPValue *ALMMultiplier = Plan.getOrAddLiveIn (
2486-         ConstantInt::get (LoopRegion->getCanonicalIV ()-> getScalarType (), 1 ));
2487+         ConstantInt::get (LoopRegion->getCanonicalIVType (), 1 ));
24872488    LaneMask =
24882489        B.createNaryOp (VPInstruction::ActiveLaneMask,
24892490                       {WideCanonicalIV, Plan.getTripCount (), ALMMultiplier},
@@ -2755,7 +2756,7 @@ void VPlanTransforms::addExplicitVectorLength(
27552756  VPBasicBlock *Header = LoopRegion->getEntryBasicBlock ();
27562757
27572758  auto  *CanonicalIVPHI = LoopRegion->getCanonicalIV ();
2758-   auto  *CanIVTy = CanonicalIVPHI-> getScalarType ();
2759+   auto  *CanIVTy = LoopRegion-> getCanonicalIVType ();
27592760  VPValue *StartV = CanonicalIVPHI->getStartValue ();
27602761
27612762  //  Create the ExplicitVectorLengthPhi recipe in the main loop.
@@ -4198,10 +4199,10 @@ void VPlanTransforms::narrowInterleaveGroups(VPlan &Plan, ElementCount VF,
41984199  VPBuilder PHBuilder (Plan.getVectorPreheader ());
41994200
42004201  VPValue *UF = Plan.getOrAddLiveIn (
4201-       ConstantInt::get (CanIV-> getScalarType (), 1  * Plan.getUF ()));
4202+       ConstantInt::get (VectorLoop-> getCanonicalIVType (), 1  * Plan.getUF ()));
42024203  if  (VF.isScalable ()) {
42034204    VPValue *VScale = PHBuilder.createElementCount (
4204-         CanIV-> getScalarType (), ElementCount::getScalable (1 ));
4205+         VectorLoop-> getCanonicalIVType (), ElementCount::getScalable (1 ));
42054206    VPValue *VScaleUF = PHBuilder.createNaryOp (Instruction::Mul, {VScale, UF});
42064207    Inc->setOperand (1 , VScaleUF);
42074208    Plan.getVF ().replaceAllUsesWith (VScale);
0 commit comments