[llvm] [LoopVectorizer][AArch64] Add support for partial reduce subtraction (PR #123636)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 30 04:01:21 PST 2025
================
@@ -282,7 +283,20 @@ InstructionCost
VPPartialReductionRecipe::computeCost(ElementCount VF,
VPCostContext &Ctx) const {
std::optional<unsigned> Opcode = std::nullopt;
- VPRecipeBase *BinOpR = getOperand(0)->getDefiningRecipe();
+ VPValue *BinOp = getOperand(0);
+ VPRecipeBase *BinOpR = BinOp->getDefiningRecipe();
+
+ using namespace llvm::PatternMatch;
+ if (auto *UnderInst =
+ dyn_cast_if_present<Instruction>(BinOp->getUnderlyingValue())) {
+ if (match(UnderInst, m_Neg(m_BinOp()))) {
+ BinOpR = BinOpR->getOperand(1)->getDefiningRecipe();
+ }
----------------
fhahn wrote:
Can't we match this on the VPValues/VPRecipes?
https://github.com/llvm/llvm-project/pull/123636
More information about the llvm-commits
mailing list