@@ -571,8 +571,7 @@ createScalarIVSteps(VPlan &Plan, InductionDescriptor::InductionKind Kind,
571571 Kind, FPBinOp, StartV, CanonicalIV, Step, " offset.idx" );
572572
573573 // Truncate base induction if needed.
574- Type *CanonicalIVType = CanonicalIV->getScalarType ();
575- VPTypeAnalysis TypeInfo (CanonicalIVType);
574+ VPTypeAnalysis TypeInfo (Plan);
576575 Type *ResultTy = TypeInfo.inferScalarType (BaseIV);
577576 if (TruncI) {
578577 Type *TruncTy = TruncI->getType ();
@@ -868,7 +867,7 @@ optimizeLatchExitInductionUser(VPlan &Plan, VPTypeAnalysis &TypeInfo,
868867void VPlanTransforms::optimizeInductionExitUsers (
869868 VPlan &Plan, DenseMap<VPValue *, VPValue *> &EndValues) {
870869 VPBlockBase *MiddleVPBB = Plan.getMiddleBlock ();
871- VPTypeAnalysis TypeInfo (Plan. getCanonicalIV ()-> getScalarType () );
870+ VPTypeAnalysis TypeInfo (Plan);
872871 for (VPIRBasicBlock *ExitVPBB : Plan.getExitBlocks ()) {
873872 for (VPRecipeBase &R : ExitVPBB->phis ()) {
874873 auto *ExitIRI = cast<VPIRPhi>(&R);
@@ -1041,7 +1040,7 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
10411040#ifndef NDEBUG
10421041 // Verify that the cached type info is for both A and its users is still
10431042 // accurate by comparing it to freshly computed types.
1044- VPTypeAnalysis TypeInfo2 (Plan-> getCanonicalIV ()-> getScalarType () );
1043+ VPTypeAnalysis TypeInfo2 (* Plan);
10451044 assert (TypeInfo.inferScalarType (A) == TypeInfo2.inferScalarType (A));
10461045 for (VPUser *U : A->users ()) {
10471046 auto *R = cast<VPRecipeBase>(U);
@@ -1221,7 +1220,7 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
12211220void VPlanTransforms::simplifyRecipes (VPlan &Plan, Type &CanonicalIVTy) {
12221221 ReversePostOrderTraversal<VPBlockDeepTraversalWrapper<VPBlockBase *>> RPOT (
12231222 Plan.getEntry ());
1224- VPTypeAnalysis TypeInfo (&CanonicalIVTy );
1223+ VPTypeAnalysis TypeInfo (Plan );
12251224 for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(RPOT)) {
12261225 for (VPRecipeBase &R : make_early_inc_range (*VPBB)) {
12271226 simplifyRecipe (R, TypeInfo);
@@ -1799,8 +1798,7 @@ void VPlanTransforms::truncateToMinimalBitwidths(
17991798 // other uses have different types for their operands, making them invalidly
18001799 // typed.
18011800 DenseMap<VPValue *, VPWidenCastRecipe *> ProcessedTruncs;
1802- Type *CanonicalIVType = Plan.getCanonicalIV ()->getScalarType ();
1803- VPTypeAnalysis TypeInfo (CanonicalIVType);
1801+ VPTypeAnalysis TypeInfo (Plan);
18041802 VPBasicBlock *PH = Plan.getVectorPreheader ();
18051803 for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
18061804 vp_depth_first_deep (Plan.getVectorLoopRegion ()))) {
@@ -1828,8 +1826,7 @@ void VPlanTransforms::truncateToMinimalBitwidths(
18281826 assert (OldResTy->isIntegerTy () && " only integer types supported" );
18291827 (void )OldResSizeInBits;
18301828
1831- LLVMContext &Ctx = CanonicalIVType->getContext ();
1832- auto *NewResTy = IntegerType::get (Ctx, NewResSizeInBits);
1829+ auto *NewResTy = IntegerType::get (Plan.getContext (), NewResSizeInBits);
18331830
18341831 // Any wrapping introduced by shrinking this operation shouldn't be
18351832 // considered undefined behavior. So, we can't unconditionally copy
@@ -2172,9 +2169,7 @@ static VPRecipeBase *optimizeMaskToEVL(VPValue *HeaderMask,
21722169
21732170// / Replace recipes with their EVL variants.
21742171static void transformRecipestoEVLRecipes (VPlan &Plan, VPValue &EVL) {
2175- Type *CanonicalIVType = Plan.getCanonicalIV ()->getScalarType ();
2176- VPTypeAnalysis TypeInfo (CanonicalIVType);
2177- LLVMContext &Ctx = CanonicalIVType->getContext ();
2172+ VPTypeAnalysis TypeInfo (Plan);
21782173 VPValue *AllOneMask = Plan.getTrue ();
21792174 VPRegionBlock *LoopRegion = Plan.getVectorLoopRegion ();
21802175 VPBasicBlock *Header = LoopRegion->getEntryBasicBlock ();
@@ -2213,9 +2208,9 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
22132208 VPValue *MaxEVL = &Plan.getVF ();
22142209 // Emit VPScalarCastRecipe in preheader if VF is not a 32 bits integer.
22152210 VPBuilder Builder (LoopRegion->getPreheaderVPBB ());
2216- MaxEVL = Builder.createScalarZExtOrTrunc (MaxEVL, Type::getInt32Ty (Ctx),
2217- TypeInfo. inferScalarType (MaxEVL ),
2218- DebugLoc ());
2211+ MaxEVL = Builder.createScalarZExtOrTrunc (
2212+ MaxEVL, Type::getInt32Ty (Plan. getContext () ),
2213+ TypeInfo. inferScalarType (MaxEVL), DebugLoc ());
22192214
22202215 Builder.setInsertPoint (Header, Header->getFirstNonPhi ());
22212216 VPValue *PrevEVL =
@@ -2230,7 +2225,7 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
22302225 m_VPValue (V1), m_VPValue (V2))))
22312226 continue ;
22322227 VPValue *Imm = Plan.getOrAddLiveIn (
2233- ConstantInt::getSigned (Type::getInt32Ty (Ctx ), -1 ));
2228+ ConstantInt::getSigned (Type::getInt32Ty (Plan. getContext () ), -1 ));
22342229 VPWidenIntrinsicRecipe *VPSplice = new VPWidenIntrinsicRecipe (
22352230 Intrinsic::experimental_vp_splice,
22362231 {V1, V2, Imm, AllOneMask, PrevEVL, &EVL},
@@ -2370,7 +2365,7 @@ void VPlanTransforms::addExplicitVectorLength(
23702365 Builder.setInsertPoint (CanonicalIVIncrement);
23712366 VPValue *OpVPEVL = VPEVL;
23722367
2373- auto *I32Ty = Type::getInt32Ty (CanIVTy-> getContext ());
2368+ auto *I32Ty = Type::getInt32Ty (Plan. getContext ());
23742369 OpVPEVL = Builder.createScalarZExtOrTrunc (
23752370 OpVPEVL, CanIVTy, I32Ty, CanonicalIVIncrement->getDebugLoc ());
23762371
@@ -2712,7 +2707,7 @@ expandVPWidenIntOrFpInduction(VPWidenIntOrFpInductionRecipe *WidenIVR,
27122707
27132708 // Construct the initial value of the vector IV in the vector loop preheader.
27142709 Type *IVIntTy =
2715- IntegerType::get (StepTy ->getContext (), StepTy->getScalarSizeInBits ());
2710+ IntegerType::get (Plan ->getContext (), StepTy->getScalarSizeInBits ());
27162711 VPValue *Init = Builder.createNaryOp (VPInstruction::StepVector, {}, IVIntTy);
27172712 if (StepTy->isFloatingPointTy ())
27182713 Init = Builder.createWidenCast (Instruction::UIToFP, Init, StepTy);
@@ -2841,7 +2836,7 @@ void VPlanTransforms::dissolveLoopRegions(VPlan &Plan) {
28412836
28422837void VPlanTransforms::convertToConcreteRecipes (VPlan &Plan,
28432838 Type &CanonicalIVTy) {
2844- VPTypeAnalysis TypeInfo (&CanonicalIVTy );
2839+ VPTypeAnalysis TypeInfo (Plan );
28452840 SmallVector<VPRecipeBase *> ToRemove;
28462841 for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
28472842 vp_depth_first_deep (Plan.getEntry ()))) {
@@ -3408,9 +3403,7 @@ void VPlanTransforms::narrowInterleaveGroups(VPlan &Plan, ElementCount VF,
34083403 if (VF.isScalable () || !VectorLoop)
34093404 return ;
34103405
3411- VPCanonicalIVPHIRecipe *CanonicalIV = Plan.getCanonicalIV ();
3412- Type *CanonicalIVType = CanonicalIV->getScalarType ();
3413- VPTypeAnalysis TypeInfo (CanonicalIVType);
3406+ VPTypeAnalysis TypeInfo (Plan);
34143407
34153408 unsigned FixedVF = VF.getFixedValue ();
34163409 SmallVector<VPInterleaveRecipe *> StoreGroups;
0 commit comments