[llvm] [LV] Create in-loop sub reductions (PR #147026)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 8 00:53:31 PDT 2025


================
@@ -1288,6 +1312,9 @@ RecurrenceDescriptor::getReductionOpChain(PHINode *Phi, Loop *L) const {
     if (isFMulAddIntrinsic(Cur))
       return true;
 
+    if (Cur->getOpcode() == Instruction::Sub && getOpcode() == Instruction::Add)
----------------
sdesmalen-arm wrote:

This should explicitly check for the reduction kind, not just the opcodes, i.e.
```
if (Cur->getOpcode() == Instruction::Sub && Kind == RecurKind::AddChainWithSubs)
```

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


More information about the llvm-commits mailing list