[llvm] Add LoopVectorizer support for `llvm.vector.partial.reduce.fadd` (PR #163975)
Benjamin Maxwell via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 12 05:24:44 PST 2025
================
@@ -5798,17 +5798,25 @@ InstructionCost AArch64TTIImpl::getPartialReductionCost(
(!ST->isNeonAvailable() || !ST->hasDotProd()))
return Invalid;
- if ((Opcode != Instruction::Add && Opcode != Instruction::Sub) ||
+ if ((Opcode != Instruction::Add && Opcode != Instruction::Sub &&
+ Opcode != Instruction::FAdd) ||
OpAExtend == TTI::PR_None)
return Invalid;
+ // Floating-point partial reductions are invalid if `reassoc` and `contract`
+ // are not allowed.
+ if (Opcode == Instruction::FAdd &&
+ (!FMF->allowReassoc() || !FMF->allowContract()))
----------------
MacDue wrote:
Assumptions should be checked via assertions (that state the assumption) rather than deliberate errors (a `std::optional` error is not very helpful, and it's unclear if it was intentional or a bug).
https://github.com/llvm/llvm-project/pull/163975
More information about the llvm-commits
mailing list