File tree Expand file tree Collapse file tree 4 files changed +12
-14
lines changed
llvm/lib/Transforms/Vectorize Expand file tree Collapse file tree 4 files changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -2797,9 +2797,12 @@ class VPSingleDefBundleRecipe : public VPSingleDefRecipe {
27972797 return new VPSingleDefBundleRecipe (BundleType, NewBundledRecipes);
27982798 }
27992799
2800- // / Return the VPSingleDefRecipe producing the final result of the bundled
2801- // / recipe.
2802- VPSingleDefRecipe *getResultRecipe () const { return BundledRecipes.back (); }
2800+ // / Return the VPValue to use to infer the result type of the recipe.
2801+ VPValue *getTypeVPValue () const {
2802+ unsigned OpIdx =
2803+ cast<VPReductionRecipe>(BundledRecipes.back ())->isConditional () ? 2 : 1 ;
2804+ return getOperand (getNumOperands () - OpIdx);
2805+ }
28032806
28042807 // / Insert the bundled recipes back into the VPlan, directly before the
28052808 // / current recipe. Leaves the bundle recipe empty, which must be removed
Original file line number Diff line number Diff line change @@ -269,14 +269,6 @@ Type *VPTypeAnalysis::inferScalarType(const VPValue *V) {
269269
270270 Type *ResultTy =
271271 TypeSwitch<const VPRecipeBase *, Type *>(V->getDefiningRecipe ())
272- .Case <VPBundleRecipe>([this ](const auto *R) {
273- unsigned RdxOpIdxOffset =
274- cast<VPReductionRecipe>(R->getResultRecipe ())->isConditional ()
275- ? 2
276- : 1 ;
277- return inferScalarType (
278- R->getOperand (R->getNumOperands () - RdxOpIdxOffset));
279- })
280272 .Case <VPActiveLaneMaskPHIRecipe, VPCanonicalIVPHIRecipe,
281273 VPFirstOrderRecurrencePHIRecipe, VPReductionPHIRecipe,
282274 VPWidenPointerInductionRecipe, VPEVLBasedIVPHIRecipe>(
@@ -311,6 +303,9 @@ Type *VPTypeAnalysis::inferScalarType(const VPValue *V) {
311303 })
312304 .Case <VPReductionRecipe>([this ](const auto *R) {
313305 return inferScalarType (R->getChainOp ());
306+ })
307+ .Case <VPSingleDefBundleRecipe>([this ](const auto *R) {
308+ return inferScalarType (R->getTypeVPValue ());
314309 });
315310
316311 assert (ResultTy && " could not infer type for the given VPValue" );
Original file line number Diff line number Diff line change @@ -2608,7 +2608,7 @@ void VPSingleDefBundleRecipe::unbundle() {
26082608 for (const auto &[Idx, Op] : enumerate(operands ()))
26092609 BundleLiveInPlaceholders[Idx]->replaceAllUsesWith (Op);
26102610
2611- replaceAllUsesWith (getResultRecipe ());
2611+ replaceAllUsesWith (BundledRecipes. back ());
26122612 BundledRecipes.clear ();
26132613}
26142614
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ namespace llvm {
3232// Forward declarations.
3333class raw_ostream ;
3434class Value ;
35- class VPBundleRecipe ;
35+ class VPSinglDefBundleRecipe ;
3636class VPDef ;
3737struct VPDoubleValueDef ;
3838class VPSlotTracker ;
@@ -50,7 +50,7 @@ class VPValue {
5050 friend struct VPDoubleValueDef ;
5151 friend class VPInterleaveRecipe ;
5252 friend class VPlan ;
53- friend class VPBundleRecipe ;
53+ friend class VPSingleDefBundleRecipe ;
5454
5555 const unsigned char SubclassID; // /< Subclass identifier (for isa/dyn_cast).
5656
You can’t perform that action at this time.
0 commit comments