@@ -571,8 +571,7 @@ createScalarIVSteps(VPlan &Plan, InductionDescriptor::InductionKind Kind,
571
571
Kind, FPBinOp, StartV, CanonicalIV, Step, " offset.idx" );
572
572
573
573
// Truncate base induction if needed.
574
- Type *CanonicalIVType = CanonicalIV->getScalarType ();
575
- VPTypeAnalysis TypeInfo (CanonicalIVType);
574
+ VPTypeAnalysis TypeInfo (Plan);
576
575
Type *ResultTy = TypeInfo.inferScalarType (BaseIV);
577
576
if (TruncI) {
578
577
Type *TruncTy = TruncI->getType ();
@@ -868,7 +867,7 @@ optimizeLatchExitInductionUser(VPlan &Plan, VPTypeAnalysis &TypeInfo,
868
867
void VPlanTransforms::optimizeInductionExitUsers (
869
868
VPlan &Plan, DenseMap<VPValue *, VPValue *> &EndValues) {
870
869
VPBlockBase *MiddleVPBB = Plan.getMiddleBlock ();
871
- VPTypeAnalysis TypeInfo (Plan. getCanonicalIV ()-> getScalarType () );
870
+ VPTypeAnalysis TypeInfo (Plan);
872
871
for (VPIRBasicBlock *ExitVPBB : Plan.getExitBlocks ()) {
873
872
for (VPRecipeBase &R : ExitVPBB->phis ()) {
874
873
auto *ExitIRI = cast<VPIRPhi>(&R);
@@ -1041,7 +1040,7 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
1041
1040
#ifndef NDEBUG
1042
1041
// Verify that the cached type info is for both A and its users is still
1043
1042
// accurate by comparing it to freshly computed types.
1044
- VPTypeAnalysis TypeInfo2 (Plan-> getCanonicalIV ()-> getScalarType () );
1043
+ VPTypeAnalysis TypeInfo2 (* Plan);
1045
1044
assert (TypeInfo.inferScalarType (A) == TypeInfo2.inferScalarType (A));
1046
1045
for (VPUser *U : A->users ()) {
1047
1046
auto *R = cast<VPRecipeBase>(U);
@@ -1221,7 +1220,7 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
1221
1220
void VPlanTransforms::simplifyRecipes (VPlan &Plan, Type &CanonicalIVTy) {
1222
1221
ReversePostOrderTraversal<VPBlockDeepTraversalWrapper<VPBlockBase *>> RPOT (
1223
1222
Plan.getEntry ());
1224
- VPTypeAnalysis TypeInfo (&CanonicalIVTy );
1223
+ VPTypeAnalysis TypeInfo (Plan );
1225
1224
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(RPOT)) {
1226
1225
for (VPRecipeBase &R : make_early_inc_range (*VPBB)) {
1227
1226
simplifyRecipe (R, TypeInfo);
@@ -1799,8 +1798,7 @@ void VPlanTransforms::truncateToMinimalBitwidths(
1799
1798
// other uses have different types for their operands, making them invalidly
1800
1799
// typed.
1801
1800
DenseMap<VPValue *, VPWidenCastRecipe *> ProcessedTruncs;
1802
- Type *CanonicalIVType = Plan.getCanonicalIV ()->getScalarType ();
1803
- VPTypeAnalysis TypeInfo (CanonicalIVType);
1801
+ VPTypeAnalysis TypeInfo (Plan);
1804
1802
VPBasicBlock *PH = Plan.getVectorPreheader ();
1805
1803
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
1806
1804
vp_depth_first_deep (Plan.getVectorLoopRegion ()))) {
@@ -1828,8 +1826,7 @@ void VPlanTransforms::truncateToMinimalBitwidths(
1828
1826
assert (OldResTy->isIntegerTy () && " only integer types supported" );
1829
1827
(void )OldResSizeInBits;
1830
1828
1831
- LLVMContext &Ctx = CanonicalIVType->getContext ();
1832
- auto *NewResTy = IntegerType::get (Ctx, NewResSizeInBits);
1829
+ auto *NewResTy = IntegerType::get (Plan.getContext (), NewResSizeInBits);
1833
1830
1834
1831
// Any wrapping introduced by shrinking this operation shouldn't be
1835
1832
// considered undefined behavior. So, we can't unconditionally copy
@@ -2172,9 +2169,7 @@ static VPRecipeBase *optimizeMaskToEVL(VPValue *HeaderMask,
2172
2169
2173
2170
// / Replace recipes with their EVL variants.
2174
2171
static 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);
2178
2173
VPValue *AllOneMask = Plan.getTrue ();
2179
2174
VPRegionBlock *LoopRegion = Plan.getVectorLoopRegion ();
2180
2175
VPBasicBlock *Header = LoopRegion->getEntryBasicBlock ();
@@ -2213,9 +2208,9 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
2213
2208
VPValue *MaxEVL = &Plan.getVF ();
2214
2209
// Emit VPScalarCastRecipe in preheader if VF is not a 32 bits integer.
2215
2210
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 ());
2219
2214
2220
2215
Builder.setInsertPoint (Header, Header->getFirstNonPhi ());
2221
2216
VPValue *PrevEVL =
@@ -2230,7 +2225,7 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
2230
2225
m_VPValue (V1), m_VPValue (V2))))
2231
2226
continue ;
2232
2227
VPValue *Imm = Plan.getOrAddLiveIn (
2233
- ConstantInt::getSigned (Type::getInt32Ty (Ctx ), -1 ));
2228
+ ConstantInt::getSigned (Type::getInt32Ty (Plan. getContext () ), -1 ));
2234
2229
VPWidenIntrinsicRecipe *VPSplice = new VPWidenIntrinsicRecipe (
2235
2230
Intrinsic::experimental_vp_splice,
2236
2231
{V1, V2, Imm, AllOneMask, PrevEVL, &EVL},
@@ -2370,7 +2365,7 @@ void VPlanTransforms::addExplicitVectorLength(
2370
2365
Builder.setInsertPoint (CanonicalIVIncrement);
2371
2366
VPValue *OpVPEVL = VPEVL;
2372
2367
2373
- auto *I32Ty = Type::getInt32Ty (CanIVTy-> getContext ());
2368
+ auto *I32Ty = Type::getInt32Ty (Plan. getContext ());
2374
2369
OpVPEVL = Builder.createScalarZExtOrTrunc (
2375
2370
OpVPEVL, CanIVTy, I32Ty, CanonicalIVIncrement->getDebugLoc ());
2376
2371
@@ -2712,7 +2707,7 @@ expandVPWidenIntOrFpInduction(VPWidenIntOrFpInductionRecipe *WidenIVR,
2712
2707
2713
2708
// Construct the initial value of the vector IV in the vector loop preheader.
2714
2709
Type *IVIntTy =
2715
- IntegerType::get (StepTy ->getContext (), StepTy->getScalarSizeInBits ());
2710
+ IntegerType::get (Plan ->getContext (), StepTy->getScalarSizeInBits ());
2716
2711
VPValue *Init = Builder.createNaryOp (VPInstruction::StepVector, {}, IVIntTy);
2717
2712
if (StepTy->isFloatingPointTy ())
2718
2713
Init = Builder.createWidenCast (Instruction::UIToFP, Init, StepTy);
@@ -2841,7 +2836,7 @@ void VPlanTransforms::dissolveLoopRegions(VPlan &Plan) {
2841
2836
2842
2837
void VPlanTransforms::convertToConcreteRecipes (VPlan &Plan,
2843
2838
Type &CanonicalIVTy) {
2844
- VPTypeAnalysis TypeInfo (&CanonicalIVTy );
2839
+ VPTypeAnalysis TypeInfo (Plan );
2845
2840
SmallVector<VPRecipeBase *> ToRemove;
2846
2841
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
2847
2842
vp_depth_first_deep (Plan.getEntry ()))) {
@@ -3408,9 +3403,7 @@ void VPlanTransforms::narrowInterleaveGroups(VPlan &Plan, ElementCount VF,
3408
3403
if (VF.isScalable () || !VectorLoop)
3409
3404
return ;
3410
3405
3411
- VPCanonicalIVPHIRecipe *CanonicalIV = Plan.getCanonicalIV ();
3412
- Type *CanonicalIVType = CanonicalIV->getScalarType ();
3413
- VPTypeAnalysis TypeInfo (CanonicalIVType);
3406
+ VPTypeAnalysis TypeInfo (Plan);
3414
3407
3415
3408
unsigned FixedVF = VF.getFixedValue ();
3416
3409
SmallVector<VPInterleaveRecipe *> StoreGroups;
0 commit comments