[llvm] Add LoopVectorizer support for `llvm.vector.partial.reduce.fadd` (PR #163975)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 2 09:47:21 PST 2025


================
@@ -8301,6 +8302,9 @@ VPRecipeBuilder::tryToCreatePartialReduction(VPInstruction *Reduction,
          "all accumulators in chain must have same scale factor");
 
   auto *ReductionI = Reduction->getUnderlyingInstr();
+  if (Reduction->getOpcode() == Instruction::FAdd &&
+      !ReductionI->hasAllowReassoc())
+    return nullptr;
----------------
MacDue wrote:

Following on from https://github.com/llvm/llvm-project/pull/159776#discussion_r2556779095, I think this needs to be:
```suggestion
  if (Reduction->getOpcode() == Instruction::FAdd &&
      (!ReductionI->hasAllowReassoc() || !ReductionI->hasAllowContract()))
    return nullptr;
```

https://github.com/llvm/llvm-project/pull/163975


More information about the llvm-commits mailing list