[llvm] [VPlan] Support multiple F(Max|Min)Num reductions. (PR #161735)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 8 03:51:09 PDT 2025


================
@@ -884,52 +871,69 @@ bool VPlanTransforms::handleMaxMinNumReductions(VPlan &Plan) {
   }
 
   VPBasicBlock *LatchVPBB = LoopRegion->getExitingBasicBlock();
+  VPBasicBlock *MiddleVPBB = Plan.getMiddleBlock();
+  VPBuilder MiddleBuilder(MiddleVPBB, MiddleVPBB->begin());
   VPBuilder Builder(LatchVPBB->getTerminator());
-  auto *LatchExitingBranch = cast<VPInstruction>(LatchVPBB->getTerminator());
-  assert(LatchExitingBranch->getOpcode() == VPInstruction::BranchOnCount &&
+  VPValue *AnyNaN = nullptr;
+  SmallPtrSet<VPValue *, 2> RdxResults;
+  for (VPReductionPHIRecipe *RedPhiR : ReductionsToConvert) {
+    VPValue *MinMaxOp = GetMinMaxCompareValue(RedPhiR);
----------------
fhahn wrote:

I'll check separately.

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


More information about the llvm-commits mailing list