[llvm-branch-commits] [llvm] [LV] Add ExtNegatedMulAccReduction expression type (PR #160154)

Sander de Smalen via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Sep 23 02:30:58 PDT 2025


================
@@ -3524,14 +3524,22 @@ tryToMatchAndCreateMulAccumulateReduction(VPReductionRecipe *Red,
   };
 
   VPValue *VecOp = Red->getVecOp();
+  VPValue *Mul = nullptr;
+  VPValue *Sub = nullptr;
   VPValue *A, *B;
+  // Sub reductions could have a sub between the add reduction and vec op.
+  if (match(VecOp,
+            m_Binary<Instruction::Sub>(m_SpecificInt(0), m_VPValue(Mul))))
+    Sub = VecOp;
+  else
+    Mul = VecOp;
----------------
sdesmalen-arm wrote:

There is a lot of renaming going on, making this change a lot bigger than it should be. If you would write:
```
VPValue *Sub = nullptr;
// Sub reductions could have a sub between the add reduction and vec op.
if (match(VecOp,
          m_Binary<Instruction::Sub>(m_SpecificInt(0), m_VPValue(VecOp))))
  Sub = Red->getVecOp();
```
Then you can do away with the changes that just rename `VecOp` -> `Mul` and `Mul -> MulR`.

I mentioned this in a previous review, but this suggestion somehow got reverted again. 

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


More information about the llvm-branch-commits mailing list