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

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 30 06:16:07 PDT 2025


================
@@ -897,8 +898,9 @@ RecurrenceDescriptor::InstDesc RecurrenceDescriptor::isRecurrenceInstr(
   case Instruction::PHI:
     return InstDesc(I, Prev.getRecKind(), Prev.getExactFPMathInst());
   case Instruction::Sub:
+    return InstDesc(Kind == RecurKind::Sub, I);
   case Instruction::Add:
-    return InstDesc(Kind == RecurKind::Add, I);
+    return InstDesc(Kind == RecurKind::Add || Kind == RecurKind::Sub, I);
----------------
sdesmalen-arm wrote:

Remove redundant condition:

```suggestion
    return InstDesc(Kind == RecurKind::Add, I);
```

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


More information about the llvm-commits mailing list