[llvm] [LoopVectorizer] Add support for chaining partial reductions (PR #120272)
Sam Tebbs via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 20 03:30:44 PST 2025
================
@@ -2453,13 +2453,16 @@ class VPPartialReductionRecipe : public VPSingleDefRecipe {
: VPSingleDefRecipe(VPDef::VPPartialReductionSC,
ArrayRef<VPValue *>({Op0, Op1}), ReductionInst),
Opcode(Opcode) {
- assert(isa<VPReductionPHIRecipe>(getOperand(1)->getDefiningRecipe()) &&
+ auto *DefiningRecipe = getOperand(1)->getDefiningRecipe();
+ assert((isa<VPReductionPHIRecipe>(DefiningRecipe) ||
+ isa<VPPartialReductionRecipe>(DefiningRecipe)) &&
"Unexpected operand order for partial reduction recipe");
}
~VPPartialReductionRecipe() override = default;
VPPartialReductionRecipe *clone() override {
- return new VPPartialReductionRecipe(Opcode, getOperand(0), getOperand(1));
+ return new VPPartialReductionRecipe(Opcode, getOperand(0), getOperand(1),
+ getUnderlyingInstr());
----------------
SamTebbs33 wrote:
Why do we need to set the underlying instruction here? Partial reductions aren't equivalent to their underlying add/sub instruction.
https://github.com/llvm/llvm-project/pull/120272
More information about the llvm-commits
mailing list