File tree Expand file tree Collapse file tree 4 files changed +22
-5
lines changed
llvm/lib/Transforms/Vectorize Expand file tree Collapse file tree 4 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -9469,13 +9469,17 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
9469
9469
CostCtx, Range);
9470
9470
}
9471
9471
9472
- // Update VF after convertToAbstractRecipes. Cannot set the VF here since
9472
+ // Update VF after ` convertToAbstractRecipes` . Cannot set the VF here since
9473
9473
// `handleUncountableEarlyExit` will check the VF of the plan, need to set
9474
9474
// before it and update.
9475
9475
// TODO: Use a better method that only set the VF for plan once.
9476
- Plan->clearVF ();
9477
- for (ElementCount VF : Range)
9478
- Plan->addVF (VF);
9476
+ SmallVector<ElementCount, 2 > VFToRemove;
9477
+ for (ElementCount VF : Plan->vectorFactors ())
9478
+ if (!Range.contains (VF))
9479
+ VFToRemove.push_back (VF);
9480
+
9481
+ for (ElementCount VF : VFToRemove)
9482
+ Plan->removeVF (VF);
9479
9483
9480
9484
// Interleave memory: for each Interleave Group we marked earlier as relevant
9481
9485
// for this VPlan, replace the Recipes widening its memory instructions with a
Original file line number Diff line number Diff line change @@ -3797,7 +3797,7 @@ class VPlan {
3797
3797
VFs.insert (VF);
3798
3798
}
3799
3799
3800
- void clearVF ( ) { VFs.clear ( ); }
3800
+ void removeVF (ElementCount VF ) { VFs.remove (VF ); }
3801
3801
3802
3802
bool hasVF (ElementCount VF) const { return VFs.count (VF); }
3803
3803
bool hasScalableVF () const {
Original file line number Diff line number Diff line change @@ -273,6 +273,14 @@ Type *VPTypeAnalysis::inferScalarType(const VPValue *V) {
273
273
[](const VPWidenCastRecipe *R) { return R->getResultType (); })
274
274
.Case <VPScalarCastRecipe>(
275
275
[](const VPScalarCastRecipe *R) { return R->getResultType (); })
276
+ .Case <VPExtendedReductionRecipe>(
277
+ [](const VPExtendedReductionRecipe *R) {
278
+ return R->getResultType ();
279
+ })
280
+ .Case <VPMulAccumulateReductionRecipe>(
281
+ [](const VPMulAccumulateReductionRecipe *R) {
282
+ return R->getResultType ();
283
+ })
276
284
.Case <VPExpandSCEVRecipe>([](const VPExpandSCEVRecipe *R) {
277
285
return R->getSCEV ()->getType ();
278
286
})
Original file line number Diff line number Diff line change @@ -78,6 +78,11 @@ struct VFRange {
78
78
return End.getKnownMinValue () <= Start.getKnownMinValue ();
79
79
}
80
80
81
+ bool contains (const ElementCount &VF) const {
82
+ return VF.getKnownMinValue () >= Start.getKnownMinValue () &&
83
+ VF.getKnownMinValue () < End.getKnownMinValue ();
84
+ }
85
+
81
86
VFRange (const ElementCount &Start, const ElementCount &End)
82
87
: Start(Start), End(End) {
83
88
assert (Start.isScalable () == End.isScalable () &&
You can’t perform that action at this time.
0 commit comments