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

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 5 07:29:06 PST 2025


================
@@ -879,52 +873,71 @@ bool VPlanTransforms::handleMaxMinNumReductions(VPlan &Plan) {
   }
 
   VPBasicBlock *LatchVPBB = LoopRegion->getExitingBasicBlock();
-  VPBuilder Builder(LatchVPBB->getTerminator());
-  auto *LatchExitingBranch = cast<VPInstruction>(LatchVPBB->getTerminator());
-  assert(LatchExitingBranch->getOpcode() == VPInstruction::BranchOnCount &&
+  VPBuilder LatchBuilder(LatchVPBB->getTerminator());
+  VPValue *IsNaNLane = nullptr;
+  SmallPtrSet<VPValue *, 2> RdxResults;
+  for (const auto &[RedPhiR, MinMaxOp] : MinMaxNumReductionsToHandle) {
+    assert(RecurrenceDescriptor::isFPMinMaxNumRecurrenceKind(
+               RedPhiR->getRecurrenceKind()) &&
+           "unsupported reduction");
----------------
ayalz wrote:

RedPhiR used only by assert.

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


More information about the llvm-commits mailing list