@@ -2924,21 +2924,23 @@ tryToCreateAbstractPartialReductionRecipe(VPPartialReductionRecipe *PRed) {
2924
2924
if (PRed->getOpcode () != Instruction::Add)
2925
2925
return ;
2926
2926
2927
- VPRecipeBase *BinOpR = PRed->getBinOp ()->getDefiningRecipe ();
2928
- auto *BinOp = dyn_cast<VPWidenRecipe>(BinOpR);
2929
- if (!BinOp || BinOp->getOpcode () != Instruction::Mul)
2927
+ using namespace llvm ::VPlanPatternMatch;
2928
+ auto *BinOp = PRed->getBinOp ();
2929
+ if (!match (BinOp,
2930
+ m_Mul (m_ZExtOrSExt (m_VPValue ()), m_ZExtOrSExt (m_VPValue ()))))
2930
2931
return ;
2931
2932
2932
- auto *Ext0 = dyn_cast<VPWidenCastRecipe>(BinOp->getOperand (0 ));
2933
- auto *Ext1 = dyn_cast<VPWidenCastRecipe>(BinOp->getOperand (1 ));
2933
+ auto *BinOpR = cast<VPWidenRecipe>(BinOp->getDefiningRecipe ());
2934
+ VPWidenCastRecipe *Ext0R = dyn_cast<VPWidenCastRecipe>(BinOpR->getOperand (0 ));
2935
+ VPWidenCastRecipe *Ext1R = dyn_cast<VPWidenCastRecipe>(BinOpR->getOperand (1 ));
2936
+
2934
2937
// TODO: Make work with extends of different signedness
2935
- if (!Ext0 || Ext0->hasMoreThanOneUniqueUser () || !Ext1 ||
2936
- Ext1->hasMoreThanOneUniqueUser () ||
2937
- Ext0->getOpcode () != Ext1->getOpcode ())
2938
+ if (Ext0R->hasMoreThanOneUniqueUser () || Ext1R->hasMoreThanOneUniqueUser () ||
2939
+ Ext0R->getOpcode () != Ext1R->getOpcode ())
2938
2940
return ;
2939
2941
2940
- auto *AbstractR = new VPMulAccumulateReductionRecipe (PRed, BinOp, Ext0, Ext1,
2941
- Ext0 ->getResultType ());
2942
+ auto *AbstractR = new VPMulAccumulateReductionRecipe (
2943
+ PRed, BinOpR, Ext0R, Ext1R, Ext0R ->getResultType ());
2942
2944
AbstractR->insertBefore (PRed);
2943
2945
PRed->replaceAllUsesWith (AbstractR);
2944
2946
}
0 commit comments