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

Sam Tebbs via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 20 06:19:39 PDT 2025


================
@@ -5309,14 +5309,16 @@ LoopVectorizationCostModel::getReductionPatternCost(Instruction *I,
   // it is not we return an invalid cost specifying the orignal cost method
   // should be used.
   Instruction *RetI = I;
-  if (match(RetI, m_ZExtOrSExt(m_Value()))) {
+  if (match(RetI, m_ZExtOrSExt(m_Value())) || match(RetI, m_FPExt(m_Value()))) {
     if (!RetI->hasOneUser())
       return std::nullopt;
     RetI = RetI->user_back();
   }
 
-  if (match(RetI, m_OneUse(m_Mul(m_Value(), m_Value()))) &&
-      RetI->user_back()->getOpcode() == Instruction::Add) {
+  if ((match(RetI, m_OneUse(m_Mul(m_Value(), m_Value()))) &&
+       RetI->user_back()->getOpcode() == Instruction::Add) ||
+      (match(RetI, m_OneUse(m_FMul(m_Value(), m_Value()))) &&
+       RetI->user_back()->getOpcode() == Instruction::FAdd)) {
----------------
SamTebbs33 wrote:

Are these changes tested? It looks like they could be doing something independent of the rest of the patch.

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


More information about the llvm-commits mailing list