[llvm] [LoopUnroll] Support parallel reductions for minmax (PR #182473)

Madhur Amilkanthwar via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 30 20:53:01 PDT 2026


================
@@ -363,14 +363,12 @@ static RecurrenceDescriptor getMinMaxRecurrence(PHINode *Phi, Loop *TheLoop,
   // Validate chain entries and collect stores from chain entries and
   // intermediate ops.
   SmallVector<StoreInst *> Stores;
-  unsigned OutOfLoopUses = 0;
   for (Value *V : Chain) {
     for (User *U : V->users()) {
       if (Chain.contains(U))
         continue;
       auto *I = dyn_cast<Instruction>(U);
-      if (!I || (!TheLoop->contains(I) &&
-                 (V != BackedgeValue || ++OutOfLoopUses > 1)))
+      if (!I || (!TheLoop->contains(I) && V != BackedgeValue))
----------------
madhur13490 wrote:

Ping @fhahn. Can you please let me know what you think about the patch?

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


More information about the llvm-commits mailing list