================ @@ -2432,12 +2437,40 @@ static void tryToCreateAbstractReductionRecipe(VPReductionRecipe *Red, Red->replaceAllUsesWith(AbstractR); } +/// This function tries to create an abstract recipe from a partial reduction to +/// hide its mul and extends from cost estimation. +static void +tryToCreateAbstractPartialReductionRecipe(VPPartialReductionRecipe *PRed) { + if (PRed->getOpcode() != Instruction::Add) + return; + + VPRecipeBase *BinOpR = PRed->getBinOp()->getDefiningRecipe(); + auto *BinOp = dyn_cast<VPWidenRecipe>(BinOpR); + if (!BinOp || BinOp->getOpcode() != Instruction::Mul) + return; ---------------- fhahn wrote:
```suggestion VPRecipeBase *BinOpR = PRed->getBinOp()->getDefiningRecipe(); auto *BinOp = dyn_cast<VPWidenRecipe>(BinOpR); if (!match(PRed->getBinOp(), m_Mul(m_ZExtOrSExt(Ext0), m_ZExtOrSExt(Ext1))))` return; ``` Could you use pattern matching to combine some of the checks? https://github.com/llvm/llvm-project/pull/136173 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits