[llvm] [LV] Add support for cmp reductions with decreasing IVs. (PR #140451)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed May 28 04:24:08 PDT 2025


================
@@ -990,6 +1018,12 @@ bool RecurrenceDescriptor::isReductionPHI(PHINode *Phi, Loop *TheLoop,
     LLVM_DEBUG(dbgs() << "Found a FindLastIV reduction PHI." << *Phi << "\n");
     return true;
   }
+  if (AddReductionVar(Phi, RecurKind::FindFirstIVUMin, TheLoop, FMF, RedDes, DB,
+                      AC, DT, SE)) {
+    LLVM_DEBUG(dbgs() << "Found a FindFirstV reduction PHI." << *Phi << "\n");
+    return true;
+  }
----------------
artagnon wrote:

I think it may be possible to use RecurrenceDescriptor::isSigned() to unify? Not sure.

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


More information about the llvm-commits mailing list