@@ -2444,21 +2444,23 @@ tryToCreateAbstractPartialReductionRecipe(VPPartialReductionRecipe *PRed) {
2444
2444
if (PRed->getOpcode () != Instruction::Add)
2445
2445
return ;
2446
2446
2447
- VPRecipeBase *BinOpR = PRed->getBinOp ()->getDefiningRecipe ();
2448
- auto *BinOp = dyn_cast<VPWidenRecipe>(BinOpR);
2449
- if (!BinOp || BinOp->getOpcode () != Instruction::Mul)
2447
+ using namespace llvm ::VPlanPatternMatch;
2448
+ auto *BinOp = PRed->getBinOp ();
2449
+ if (!match (BinOp,
2450
+ m_Mul (m_ZExtOrSExt (m_VPValue ()), m_ZExtOrSExt (m_VPValue ()))))
2450
2451
return ;
2451
2452
2452
- auto *Ext0 = dyn_cast<VPWidenCastRecipe>(BinOp->getOperand (0 ));
2453
- auto *Ext1 = dyn_cast<VPWidenCastRecipe>(BinOp->getOperand (1 ));
2453
+ auto *BinOpR = cast<VPWidenRecipe>(BinOp->getDefiningRecipe ());
2454
+ VPWidenCastRecipe *Ext0R = dyn_cast<VPWidenCastRecipe>(BinOpR->getOperand (0 ));
2455
+ VPWidenCastRecipe *Ext1R = dyn_cast<VPWidenCastRecipe>(BinOpR->getOperand (1 ));
2456
+
2454
2457
// TODO: Make work with extends of different signedness
2455
- if (!Ext0 || Ext0->hasMoreThanOneUniqueUser () || !Ext1 ||
2456
- Ext1->hasMoreThanOneUniqueUser () ||
2457
- Ext0->getOpcode () != Ext1->getOpcode ())
2458
+ if (Ext0R->hasMoreThanOneUniqueUser () || Ext1R->hasMoreThanOneUniqueUser () ||
2459
+ Ext0R->getOpcode () != Ext1R->getOpcode ())
2458
2460
return ;
2459
2461
2460
- auto *AbstractR = new VPMulAccumulateReductionRecipe (PRed, BinOp, Ext0, Ext1,
2461
- Ext0 ->getResultType ());
2462
+ auto *AbstractR = new VPMulAccumulateReductionRecipe (
2463
+ PRed, BinOpR, Ext0R, Ext1R, Ext0R ->getResultType ());
2462
2464
AbstractR->insertBefore (PRed);
2463
2465
PRed->replaceAllUsesWith (AbstractR);
2464
2466
}
0 commit comments