Skip to content

Conversation

@arsenm
Copy link
Contributor

@arsenm arsenm commented Dec 30, 2025

No description provided.

@arsenm arsenm added floating-point Floating-point math llvm:analysis Includes value tracking, cost tables and constant folding llvm:instcombine Covers the InstCombine, InstSimplify and AggressiveInstCombine passes llvm:support llvm:transforms labels Dec 30, 2025 — with Graphite App
@arsenm arsenm marked this pull request as ready for review December 30, 2025 11:12
@llvmbot
Copy link
Member

llvmbot commented Dec 30, 2025

@llvm/pr-subscribers-llvm-transforms

@llvm/pr-subscribers-llvm-analysis

Author: Matt Arsenault (arsenm)

Changes

Patch is 51.79 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/173977.diff

3 Files Affected:

  • (modified) llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp (+64-12)
  • (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-maximumnum.ll (+34-55)
  • (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-minimumnum.ll (+36-59)
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
index 2ae9221a00cbd..3cf5615ecb43f 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
@@ -2113,26 +2113,35 @@ Value *InstCombinerImpl::SimplifyDemandedUseFPClass(Value *V,
       break;
     }
     case Intrinsic::maximum:
-    case Intrinsic::minimum: {
-      KnownFPClass KnownLHS, KnownRHS;
+    case Intrinsic::minimum:
+    case Intrinsic::maximumnum:
+    case Intrinsic::minimumnum: {
+      const bool PropagateNaN =
+          IID == Intrinsic::maximum || IID == Intrinsic::minimum;
 
       // We can't tell much based on the demanded result without inspecting the
       // operands (e.g., a known-positive result could have been clamped), but
       // we can still prune known-nan inputs.
-      FPClassTest SrcDemandedMask = DemandedMask | ~fcNan;
+      FPClassTest SrcDemandedMask =
+          PropagateNaN ? DemandedMask | ~fcNan : fcAllFlags;
 
+      KnownFPClass KnownLHS, KnownRHS;
       if (SimplifyDemandedFPClass(CI, 1, SrcDemandedMask, KnownRHS,
                                   Depth + 1) ||
           SimplifyDemandedFPClass(CI, 0, SrcDemandedMask, KnownLHS, Depth + 1))
         return I;
 
       /// Propagate nnan-ness to simplify edge case checks.
-      if ((DemandedMask & fcNan) == fcNone) {
+      if (PropagateNaN && (DemandedMask & fcNan) == fcNone) {
         KnownLHS.knownNot(fcNan);
         KnownRHS.knownNot(fcNan);
       }
 
+      KnownFPClass::MinMaxKind OpKind;
+
       if (IID == Intrinsic::maximum) {
+        OpKind = KnownFPClass::MinMaxKind::maximum;
+
         // If at least one operand is known to be positive and the other
         // negative, the result must be the positive (unless the other operand
         // may be propagating a nan).
@@ -2152,7 +2161,9 @@ Value *InstCombinerImpl::SimplifyDemandedUseFPClass(Value *V,
         if (KnownRHS.isKnownAlways(fcPosInf | fcNan) &&
             KnownLHS.isKnownNever(fcNan))
           return CI->getArgOperand(1);
-      } else {
+      } else if (IID == Intrinsic::minimum) {
+        OpKind = KnownFPClass::MinMaxKind::minimum;
+
         // If one operand is known to be negative, and the other positive, the
         // result must be the negative (unless the other operand may be
         // propagating a nan).
@@ -2172,15 +2183,54 @@ Value *InstCombinerImpl::SimplifyDemandedUseFPClass(Value *V,
         if (KnownRHS.isKnownAlways(fcNegInf | fcNan) &&
             KnownLHS.isKnownNever(fcNan))
           return CI->getArgOperand(1);
-      }
+      } else if (IID == Intrinsic::maximumnum) {
+        OpKind = KnownFPClass::MinMaxKind::maximumnum;
+
+        // If at least one operand is known to be positive and the other
+        // negative, the result must be the positive.
+        if (KnownLHS.isKnownNever(fcNegative | fcNan) &&
+            KnownRHS.isKnownNever(fcPositive))
+          return CI->getArgOperand(0);
+
+        if (KnownRHS.isKnownNever(fcNegative | fcNan) &&
+            KnownLHS.isKnownNever(fcPositive))
+          return CI->getArgOperand(1);
+
+        // If one value must be ninf or nan, the other value must be returned
+        if (KnownLHS.isKnownAlways(fcNegInf | fcNan) &&
+            KnownRHS.isKnownNever(fcNan))
+          return CI->getArgOperand(1);
+
+        if (KnownRHS.isKnownAlways(fcNegInf | fcNan) &&
+            KnownLHS.isKnownNever(fcNan))
+          return CI->getArgOperand(0);
+      } else if (IID == Intrinsic::minimumnum) {
+        OpKind = KnownFPClass::MinMaxKind::minimumnum;
+
+        // If at least one operand is known to be negative and the other
+        // positive, the result must be the negative
+        if (KnownLHS.isKnownNever(fcPositive | fcNan) &&
+            KnownRHS.isKnownNever(fcNegative))
+          return CI->getArgOperand(0);
+
+        if (KnownRHS.isKnownNever(fcPositive | fcNan) &&
+            KnownLHS.isKnownNever(fcNegative))
+          return CI->getArgOperand(1);
+
+        // If one value must be pinf or nan, the other value must be returned
+        if (KnownLHS.isKnownAlways(fcPosInf | fcNan) &&
+            KnownRHS.isKnownNever(fcNan))
+          return CI->getArgOperand(1);
+
+        if (KnownRHS.isKnownAlways(fcPosInf | fcNan) &&
+            KnownLHS.isKnownNever(fcNan))
+          return CI->getArgOperand(0);
+      } else
+        llvm_unreachable("not a min/max intrinsic");
 
       Type *EltTy = VTy->getScalarType();
       DenormalMode Mode = F.getDenormalMode(EltTy->getFltSemantics());
-      Known = KnownFPClass::minMaxLike(KnownLHS, KnownRHS,
-                                       IID == Intrinsic::maximum
-                                           ? KnownFPClass::MinMaxKind::maximum
-                                           : KnownFPClass::MinMaxKind::minimum,
-                                       Mode);
+      Known = KnownFPClass::minMaxLike(KnownLHS, KnownRHS, OpKind, Mode);
 
       FPClassTest ValidResults = DemandedMask & Known.KnownFPClasses;
 
@@ -2194,7 +2244,9 @@ Value *InstCombinerImpl::SimplifyDemandedUseFPClass(Value *V,
 
       // TODO: Add NSZ flag if we know the result will not be sensitive on the
       // sign of 0.
-      if (!FPOp->hasNoNaNs() && (ValidResults & fcNan) == fcNone) {
+      if (!FPOp->hasNoNaNs() &&
+          ((PropagateNaN && (ValidResults & fcNan) == fcNone) ||
+           (KnownLHS.isKnownNeverNaN() && KnownRHS.isKnownNeverNaN()))) {
         CI->setHasNoNaNs(true);
         ChangedFlags = true;
       }
diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-maximumnum.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-maximumnum.ll
index fcbe2df985ea5..4c3769db721a4 100644
--- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-maximumnum.ll
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-maximumnum.ll
@@ -34,8 +34,7 @@ declare nofpclass(norm sub zero) float @returns_inf_or_nan()
 define nofpclass(inf norm sub zero) float @ret_only_nan(float %x, float %y) {
 ; CHECK-LABEL: define nofpclass(inf zero sub norm) float @ret_only_nan(
 ; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]]) {
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[X]], float [[Y]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float 0x7FF8000000000000
 ;
   %result = call float @llvm.maximumnum.f32(float %x, float %y)
   ret float %result
@@ -152,8 +151,7 @@ define nofpclass(ninf nnorm nsub nzero) float @ret_known_positive_or_nan__maximu
 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_known_positive_or_nan__maximumnum__negative_or_nan___negative_or_nan() {
 ; CHECK-NEXT:    [[MUST_BE_NEGATIVE_OR_NAN0:%.*]] = call float @returns_negative_or_nan()
 ; CHECK-NEXT:    [[MUST_BE_NEGATIVE_OR_NAN1:%.*]] = call float @returns_negative_or_nan()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[MUST_BE_NEGATIVE_OR_NAN0]], float [[MUST_BE_NEGATIVE_OR_NAN1]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float 0x7FF8000000000000
 ;
   %must.be.negative.or.nan0 = call float @returns_negative_or_nan()
   %must.be.negative.or.nan1 = call float @returns_negative_or_nan()
@@ -166,8 +164,7 @@ define nofpclass(pinf pnorm psub pzero) float @ret_known_negative_or_nan__maximu
 ; CHECK-LABEL: define nofpclass(pinf pzero psub pnorm) float @ret_known_negative_or_nan__maximumnum__positive_or_nan___positive_or_nan() {
 ; CHECK-NEXT:    [[MUST_BE_POSITIVE_OR_NAN0:%.*]] = call float @returns_positive_or_nan()
 ; CHECK-NEXT:    [[MUST_BE_POSITIVE_OR_NAN1:%.*]] = call float @returns_positive_or_nan()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[MUST_BE_POSITIVE_OR_NAN0]], float [[MUST_BE_POSITIVE_OR_NAN1]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float 0x7FF8000000000000
 ;
   %must.be.positive.or.nan0 = call float @returns_positive_or_nan()
   %must.be.positive.or.nan1 = call float @returns_positive_or_nan()
@@ -352,7 +349,7 @@ define nofpclass(snan) float @cannot_fold_negative_or_zero__positive_or_zero_0()
 ; CHECK-LABEL: define nofpclass(snan) float @cannot_fold_negative_or_zero__positive_or_zero_0() {
 ; CHECK-NEXT:    [[MUST_BE_NEGATIVE_OR_ZERO:%.*]] = call float @returns_positive_or_zero()
 ; CHECK-NEXT:    [[MUST_BE_POSITIVE_OR_ZERO:%.*]] = call float @returns_negative_or_zero()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[MUST_BE_NEGATIVE_OR_ZERO]], float [[MUST_BE_POSITIVE_OR_ZERO]])
+; CHECK-NEXT:    [[RESULT:%.*]] = call nnan float @llvm.maximumnum.f32(float [[MUST_BE_NEGATIVE_OR_ZERO]], float [[MUST_BE_POSITIVE_OR_ZERO]])
 ; CHECK-NEXT:    ret float [[RESULT]]
 ;
   %must.be.negative.or.zero = call float @returns_positive_or_zero()
@@ -366,7 +363,7 @@ define nofpclass(snan) float @cannot_fold_negative_or_zero__positive_or_zero_1()
 ; CHECK-LABEL: define nofpclass(snan) float @cannot_fold_negative_or_zero__positive_or_zero_1() {
 ; CHECK-NEXT:    [[MUST_BE_NEGATIVE_OR_ZERO:%.*]] = call float @returns_positive_or_zero()
 ; CHECK-NEXT:    [[MUST_BE_POSITIVE_OR_ZERO:%.*]] = call float @returns_negative_or_zero()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[MUST_BE_POSITIVE_OR_ZERO]], float [[MUST_BE_NEGATIVE_OR_ZERO]])
+; CHECK-NEXT:    [[RESULT:%.*]] = call nnan float @llvm.maximumnum.f32(float [[MUST_BE_POSITIVE_OR_ZERO]], float [[MUST_BE_NEGATIVE_OR_ZERO]])
 ; CHECK-NEXT:    ret float [[RESULT]]
 ;
   %must.be.negative.or.zero = call float @returns_positive_or_zero()
@@ -398,8 +395,7 @@ define nofpclass(nsub) float @rhs_must_be_pinf_or_nan(float nofpclass(ninf norm
 define nofpclass(nsub) float @lhs_must_be_pinf(float %unknown, float nofpclass(nan ninf norm zero sub) %must.be.pinf) {
 ; CHECK-LABEL: define nofpclass(nsub) float @lhs_must_be_pinf(
 ; CHECK-SAME: float [[UNKNOWN:%.*]], float nofpclass(nan ninf zero sub norm) [[MUST_BE_PINF:%.*]]) {
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[MUST_BE_PINF]], float [[UNKNOWN]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float 0x7FF0000000000000
 ;
   %result = call float @llvm.maximumnum.f32(float %must.be.pinf, float %unknown)
   ret float %result
@@ -408,8 +404,7 @@ define nofpclass(nsub) float @lhs_must_be_pinf(float %unknown, float nofpclass(n
 define nofpclass(nsub) float @rhs_must_be_pinf(float nofpclass(nan ninf norm zero sub) %must.be.pinf, float %unknown) {
 ; CHECK-LABEL: define nofpclass(nsub) float @rhs_must_be_pinf(
 ; CHECK-SAME: float nofpclass(nan ninf zero sub norm) [[MUST_BE_PINF:%.*]], float [[UNKNOWN:%.*]]) {
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[UNKNOWN]], float [[MUST_BE_PINF]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float 0x7FF0000000000000
 ;
   %result = call float @llvm.maximumnum.f32(float %unknown, float %must.be.pinf)
   ret float %result
@@ -419,8 +414,7 @@ define nofpclass(nsub) float @rhs_must_be_pinf(float nofpclass(nan ninf norm zer
 define nofpclass(nsub) float @lhs_must_be_pinf_rhs_non_nan(float nofpclass(nan) %not.nan, float nofpclass(nan ninf norm zero sub) %must.be.pinf) {
 ; CHECK-LABEL: define nofpclass(nsub) float @lhs_must_be_pinf_rhs_non_nan(
 ; CHECK-SAME: float nofpclass(nan) [[NOT_NAN:%.*]], float nofpclass(nan ninf zero sub norm) [[MUST_BE_PINF:%.*]]) {
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[MUST_BE_PINF]], float [[NOT_NAN]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float 0x7FF0000000000000
 ;
   %result = call float @llvm.maximumnum.f32(float %must.be.pinf, float %not.nan)
   ret float %result
@@ -430,8 +424,7 @@ define nofpclass(nsub) float @lhs_must_be_pinf_rhs_non_nan(float nofpclass(nan)
 define nofpclass(nsub) float @rhs_must_be_pinf_lhs_non_nan(float nofpclass(nan ninf norm zero sub) %must.be.pinf, float nofpclass(nan) %not.nan) {
 ; CHECK-LABEL: define nofpclass(nsub) float @rhs_must_be_pinf_lhs_non_nan(
 ; CHECK-SAME: float nofpclass(nan ninf zero sub norm) [[MUST_BE_PINF:%.*]], float nofpclass(nan) [[NOT_NAN:%.*]]) {
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[NOT_NAN]], float [[MUST_BE_PINF]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float 0x7FF0000000000000
 ;
   %result = call float @llvm.maximumnum.f32(float %not.nan, float %must.be.pinf)
   ret float %result
@@ -460,7 +453,7 @@ define nofpclass(nsub) float @rhs_must_be_ninf_or_nan(float nofpclass(pinf norm
 define nofpclass(nsub) float @lhs_must_be_ninf(float %unknown, float nofpclass(nan pinf norm zero sub) %must.be.ninf) {
 ; CHECK-LABEL: define nofpclass(nsub) float @lhs_must_be_ninf(
 ; CHECK-SAME: float [[UNKNOWN:%.*]], float nofpclass(nan pinf zero sub norm) [[MUST_BE_NINF:%.*]]) {
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[MUST_BE_NINF]], float [[UNKNOWN]])
+; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[UNKNOWN]], float 0xFFF0000000000000)
 ; CHECK-NEXT:    ret float [[RESULT]]
 ;
   %result = call float @llvm.maximumnum.f32(float %must.be.ninf, float %unknown)
@@ -470,7 +463,7 @@ define nofpclass(nsub) float @lhs_must_be_ninf(float %unknown, float nofpclass(n
 define nofpclass(nsub) float @rhs_must_be_ninf(float nofpclass(nan pinf norm zero sub) %must.be.ninf, float %unknown) {
 ; CHECK-LABEL: define nofpclass(nsub) float @rhs_must_be_ninf(
 ; CHECK-SAME: float nofpclass(nan pinf zero sub norm) [[MUST_BE_NINF:%.*]], float [[UNKNOWN:%.*]]) {
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[UNKNOWN]], float [[MUST_BE_NINF]])
+; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[UNKNOWN]], float 0xFFF0000000000000)
 ; CHECK-NEXT:    ret float [[RESULT]]
 ;
   %result = call float @llvm.maximumnum.f32(float %unknown, float %must.be.ninf)
@@ -482,8 +475,7 @@ define nofpclass(nsub) float @rhs_must_be_ninf(float nofpclass(nan pinf norm zer
 define nofpclass(nsub) float @lhs_must_be_ninf_rhs_non_nan(float nofpclass(nan) %not.nan, float nofpclass(nan pinf norm zero sub) %must.be.ninf) {
 ; CHECK-LABEL: define nofpclass(nsub) float @lhs_must_be_ninf_rhs_non_nan(
 ; CHECK-SAME: float nofpclass(nan) [[NOT_NAN:%.*]], float nofpclass(nan pinf zero sub norm) [[MUST_BE_NINF:%.*]]) {
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[MUST_BE_NINF]], float [[NOT_NAN]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float [[NOT_NAN]]
 ;
   %result = call float @llvm.maximumnum.f32(float %must.be.ninf, float %not.nan)
   ret float %result
@@ -493,8 +485,7 @@ define nofpclass(nsub) float @lhs_must_be_ninf_rhs_non_nan(float nofpclass(nan)
 define nofpclass(nsub) float @rhs_must_be_ninf_lhs_non_nan(float nofpclass(nan pinf norm zero sub) %must.be.ninf, float nofpclass(nan) %not.nan) {
 ; CHECK-LABEL: define nofpclass(nsub) float @rhs_must_be_ninf_lhs_non_nan(
 ; CHECK-SAME: float nofpclass(nan pinf zero sub norm) [[MUST_BE_NINF:%.*]], float nofpclass(nan) [[NOT_NAN:%.*]]) {
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[NOT_NAN]], float [[MUST_BE_NINF]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float [[NOT_NAN]]
 ;
   %result = call float @llvm.maximumnum.f32(float %not.nan, float %must.be.ninf)
   ret float %result
@@ -803,7 +794,7 @@ define nofpclass(snan) float @unknown__maximumnum__not_nan(float %x, float nofpc
 define nofpclass(snan) float @not_nan__maximumnum__not_nan(float nofpclass(nan) %x, float nofpclass(nan) %y) {
 ; CHECK-LABEL: define nofpclass(snan) float @not_nan__maximumnum__not_nan(
 ; CHECK-SAME: float nofpclass(nan) [[X:%.*]], float nofpclass(nan) [[Y:%.*]]) {
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[X]], float [[Y]])
+; CHECK-NEXT:    [[RESULT:%.*]] = call nnan float @llvm.maximumnum.f32(float [[X]], float [[Y]])
 ; CHECK-NEXT:    ret float [[RESULT]]
 ;
   %result = call float @llvm.maximumnum.f32(float %x, float %y)
@@ -834,7 +825,7 @@ define nofpclass(snan) float @known_positive__maximumnum__only_zero() {
 ; CHECK-LABEL: define nofpclass(snan) float @known_positive__maximumnum__only_zero() {
 ; CHECK-NEXT:    [[KNOWN_POSITIVE:%.*]] = call float @returns_positive()
 ; CHECK-NEXT:    [[KNOWN_ZERO:%.*]] = call float @returns_zero()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[KNOWN_POSITIVE]], float [[KNOWN_ZERO]])
+; CHECK-NEXT:    [[RESULT:%.*]] = call nnan float @llvm.maximumnum.f32(float [[KNOWN_POSITIVE]], float [[KNOWN_ZERO]])
 ; CHECK-NEXT:    ret float [[RESULT]]
 ;
   %known.positive = call float @returns_positive()
@@ -847,7 +838,7 @@ define nofpclass(snan) float @only_zero__maximumnum__known_positive() {
 ; CHECK-LABEL: define nofpclass(snan) float @only_zero__maximumnum__known_positive() {
 ; CHECK-NEXT:    [[KNOWN_ZERO:%.*]] = call float @returns_zero()
 ; CHECK-NEXT:    [[KNOWN_POSITIVE:%.*]] = call float @returns_positive()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[KNOWN_ZERO]], float [[KNOWN_POSITIVE]])
+; CHECK-NEXT:    [[RESULT:%.*]] = call nnan float @llvm.maximumnum.f32(float [[KNOWN_ZERO]], float [[KNOWN_POSITIVE]])
 ; CHECK-NEXT:    ret float [[RESULT]]
 ;
   %known.zero = call float @returns_zero()
@@ -912,8 +903,7 @@ define nofpclass(snan) float @known_positive__maximumnum__only_nzero() {
 ; CHECK-LABEL: define nofpclass(snan) float @known_positive__maximumnum__only_nzero() {
 ; CHECK-NEXT:    [[KNOWN_POSITIVE:%.*]] = call float @returns_positive()
 ; CHECK-NEXT:    [[KNOWN_NZERO:%.*]] = call float @returns_nzero()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[KNOWN_POSITIVE]], float [[KNOWN_NZERO]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float [[KNOWN_POSITIVE]]
 ;
   %known.positive = call float @returns_positive()
   %known.nzero = call float @returns_nzero()
@@ -925,8 +915,7 @@ define nofpclass(snan) float @only_nzero__maximumnum__known_positive() {
 ; CHECK-LABEL: define nofpclass(snan) float @only_nzero__maximumnum__known_positive() {
 ; CHECK-NEXT:    [[KNOWN_NZERO:%.*]] = call float @returns_nzero()
 ; CHECK-NEXT:    [[KNOWN_POSITIVE:%.*]] = call float @returns_positive()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[KNOWN_NZERO]], float [[KNOWN_POSITIVE]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float [[KNOWN_POSITIVE]]
 ;
   %known.nzero = call float @returns_nzero()
   %known.positive = call float @returns_positive()
@@ -938,7 +927,7 @@ define nofpclass(snan) float @known_positive__maximumnum__only_pzero() {
 ; CHECK-LABEL: define nofpclass(snan) float @known_positive__maximumnum__only_pzero() {
 ; CHECK-NEXT:    [[KNOWN_POSITIVE:%.*]] = call float @returns_positive()
 ; CHECK-NEXT:    [[KNOWN_PZERO:%.*]] = call float @returns_pzero()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[KNOWN_POSITIVE]], float [[KNOWN_PZERO]])
+; CHECK-NEXT:    [[RESULT:%.*]] = call nnan float @llvm.maximumnum.f32(float [[KNOWN_POSITIVE]], float 0.000000e+00)
 ; CHECK-NEXT:    ret float [[RESULT]]
 ;
   %known.positive = call float @returns_positive()
@@ -951,7 +940,7 @@ define nofpclass(snan) float @only_pzero__maximumnum__known_positive() {
 ; CHECK-LABEL: define nofpclass(snan) float @only_pzero__maximumnum__known_positive() {
 ; CHECK-NEXT:    [[KNOWN_PZERO:%.*]] = call float @returns_pzero()
 ; CHECK-NEXT:    [[KNOWN_POSITIVE:%.*]] = call float @returns_positive()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[KNOWN_PZERO]], float [[KNOWN_POSITIVE]])
+; CHECK-NEXT:    [[RESULT:%.*]] = call nnan float @llvm.maximumnum.f32(float [[KNOWN_POSITIVE]], float 0.000000e+00)
 ; CHECK-NEXT:    ret float [[RESULT]]
 ;
   %known.pzero = call float @returns_pzero()
@@ -1259,8 +1248,7 @@ define nofpclass(snan) float @known_always_positive__maximumnum__known_always_ne
 ; CHECK-LABEL: define nofpclass(snan) float @known_always_positive__maximumnum__known_always_negative_or_nan() {
 ; CHECK-NEXT:    [[KNOWN_POSITIVE:%.*]] = call float @returns_positive()
 ; CHECK-NEXT:    [[KNOWN_NEGATIVE_OR_NAN:%.*]] = call float @returns_negative_or_nan()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float ...
[truncated]

@llvmbot
Copy link
Member

llvmbot commented Dec 30, 2025

@llvm/pr-subscribers-llvm-support

Author: Matt Arsenault (arsenm)

Changes

Patch is 51.79 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/173977.diff

3 Files Affected:

  • (modified) llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp (+64-12)
  • (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-maximumnum.ll (+34-55)
  • (modified) llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-minimumnum.ll (+36-59)
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
index 2ae9221a00cbd..3cf5615ecb43f 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
@@ -2113,26 +2113,35 @@ Value *InstCombinerImpl::SimplifyDemandedUseFPClass(Value *V,
       break;
     }
     case Intrinsic::maximum:
-    case Intrinsic::minimum: {
-      KnownFPClass KnownLHS, KnownRHS;
+    case Intrinsic::minimum:
+    case Intrinsic::maximumnum:
+    case Intrinsic::minimumnum: {
+      const bool PropagateNaN =
+          IID == Intrinsic::maximum || IID == Intrinsic::minimum;
 
       // We can't tell much based on the demanded result without inspecting the
       // operands (e.g., a known-positive result could have been clamped), but
       // we can still prune known-nan inputs.
-      FPClassTest SrcDemandedMask = DemandedMask | ~fcNan;
+      FPClassTest SrcDemandedMask =
+          PropagateNaN ? DemandedMask | ~fcNan : fcAllFlags;
 
+      KnownFPClass KnownLHS, KnownRHS;
       if (SimplifyDemandedFPClass(CI, 1, SrcDemandedMask, KnownRHS,
                                   Depth + 1) ||
           SimplifyDemandedFPClass(CI, 0, SrcDemandedMask, KnownLHS, Depth + 1))
         return I;
 
       /// Propagate nnan-ness to simplify edge case checks.
-      if ((DemandedMask & fcNan) == fcNone) {
+      if (PropagateNaN && (DemandedMask & fcNan) == fcNone) {
         KnownLHS.knownNot(fcNan);
         KnownRHS.knownNot(fcNan);
       }
 
+      KnownFPClass::MinMaxKind OpKind;
+
       if (IID == Intrinsic::maximum) {
+        OpKind = KnownFPClass::MinMaxKind::maximum;
+
         // If at least one operand is known to be positive and the other
         // negative, the result must be the positive (unless the other operand
         // may be propagating a nan).
@@ -2152,7 +2161,9 @@ Value *InstCombinerImpl::SimplifyDemandedUseFPClass(Value *V,
         if (KnownRHS.isKnownAlways(fcPosInf | fcNan) &&
             KnownLHS.isKnownNever(fcNan))
           return CI->getArgOperand(1);
-      } else {
+      } else if (IID == Intrinsic::minimum) {
+        OpKind = KnownFPClass::MinMaxKind::minimum;
+
         // If one operand is known to be negative, and the other positive, the
         // result must be the negative (unless the other operand may be
         // propagating a nan).
@@ -2172,15 +2183,54 @@ Value *InstCombinerImpl::SimplifyDemandedUseFPClass(Value *V,
         if (KnownRHS.isKnownAlways(fcNegInf | fcNan) &&
             KnownLHS.isKnownNever(fcNan))
           return CI->getArgOperand(1);
-      }
+      } else if (IID == Intrinsic::maximumnum) {
+        OpKind = KnownFPClass::MinMaxKind::maximumnum;
+
+        // If at least one operand is known to be positive and the other
+        // negative, the result must be the positive.
+        if (KnownLHS.isKnownNever(fcNegative | fcNan) &&
+            KnownRHS.isKnownNever(fcPositive))
+          return CI->getArgOperand(0);
+
+        if (KnownRHS.isKnownNever(fcNegative | fcNan) &&
+            KnownLHS.isKnownNever(fcPositive))
+          return CI->getArgOperand(1);
+
+        // If one value must be ninf or nan, the other value must be returned
+        if (KnownLHS.isKnownAlways(fcNegInf | fcNan) &&
+            KnownRHS.isKnownNever(fcNan))
+          return CI->getArgOperand(1);
+
+        if (KnownRHS.isKnownAlways(fcNegInf | fcNan) &&
+            KnownLHS.isKnownNever(fcNan))
+          return CI->getArgOperand(0);
+      } else if (IID == Intrinsic::minimumnum) {
+        OpKind = KnownFPClass::MinMaxKind::minimumnum;
+
+        // If at least one operand is known to be negative and the other
+        // positive, the result must be the negative
+        if (KnownLHS.isKnownNever(fcPositive | fcNan) &&
+            KnownRHS.isKnownNever(fcNegative))
+          return CI->getArgOperand(0);
+
+        if (KnownRHS.isKnownNever(fcPositive | fcNan) &&
+            KnownLHS.isKnownNever(fcNegative))
+          return CI->getArgOperand(1);
+
+        // If one value must be pinf or nan, the other value must be returned
+        if (KnownLHS.isKnownAlways(fcPosInf | fcNan) &&
+            KnownRHS.isKnownNever(fcNan))
+          return CI->getArgOperand(1);
+
+        if (KnownRHS.isKnownAlways(fcPosInf | fcNan) &&
+            KnownLHS.isKnownNever(fcNan))
+          return CI->getArgOperand(0);
+      } else
+        llvm_unreachable("not a min/max intrinsic");
 
       Type *EltTy = VTy->getScalarType();
       DenormalMode Mode = F.getDenormalMode(EltTy->getFltSemantics());
-      Known = KnownFPClass::minMaxLike(KnownLHS, KnownRHS,
-                                       IID == Intrinsic::maximum
-                                           ? KnownFPClass::MinMaxKind::maximum
-                                           : KnownFPClass::MinMaxKind::minimum,
-                                       Mode);
+      Known = KnownFPClass::minMaxLike(KnownLHS, KnownRHS, OpKind, Mode);
 
       FPClassTest ValidResults = DemandedMask & Known.KnownFPClasses;
 
@@ -2194,7 +2244,9 @@ Value *InstCombinerImpl::SimplifyDemandedUseFPClass(Value *V,
 
       // TODO: Add NSZ flag if we know the result will not be sensitive on the
       // sign of 0.
-      if (!FPOp->hasNoNaNs() && (ValidResults & fcNan) == fcNone) {
+      if (!FPOp->hasNoNaNs() &&
+          ((PropagateNaN && (ValidResults & fcNan) == fcNone) ||
+           (KnownLHS.isKnownNeverNaN() && KnownRHS.isKnownNeverNaN()))) {
         CI->setHasNoNaNs(true);
         ChangedFlags = true;
       }
diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-maximumnum.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-maximumnum.ll
index fcbe2df985ea5..4c3769db721a4 100644
--- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-maximumnum.ll
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass-maximumnum.ll
@@ -34,8 +34,7 @@ declare nofpclass(norm sub zero) float @returns_inf_or_nan()
 define nofpclass(inf norm sub zero) float @ret_only_nan(float %x, float %y) {
 ; CHECK-LABEL: define nofpclass(inf zero sub norm) float @ret_only_nan(
 ; CHECK-SAME: float [[X:%.*]], float [[Y:%.*]]) {
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[X]], float [[Y]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float 0x7FF8000000000000
 ;
   %result = call float @llvm.maximumnum.f32(float %x, float %y)
   ret float %result
@@ -152,8 +151,7 @@ define nofpclass(ninf nnorm nsub nzero) float @ret_known_positive_or_nan__maximu
 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_known_positive_or_nan__maximumnum__negative_or_nan___negative_or_nan() {
 ; CHECK-NEXT:    [[MUST_BE_NEGATIVE_OR_NAN0:%.*]] = call float @returns_negative_or_nan()
 ; CHECK-NEXT:    [[MUST_BE_NEGATIVE_OR_NAN1:%.*]] = call float @returns_negative_or_nan()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[MUST_BE_NEGATIVE_OR_NAN0]], float [[MUST_BE_NEGATIVE_OR_NAN1]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float 0x7FF8000000000000
 ;
   %must.be.negative.or.nan0 = call float @returns_negative_or_nan()
   %must.be.negative.or.nan1 = call float @returns_negative_or_nan()
@@ -166,8 +164,7 @@ define nofpclass(pinf pnorm psub pzero) float @ret_known_negative_or_nan__maximu
 ; CHECK-LABEL: define nofpclass(pinf pzero psub pnorm) float @ret_known_negative_or_nan__maximumnum__positive_or_nan___positive_or_nan() {
 ; CHECK-NEXT:    [[MUST_BE_POSITIVE_OR_NAN0:%.*]] = call float @returns_positive_or_nan()
 ; CHECK-NEXT:    [[MUST_BE_POSITIVE_OR_NAN1:%.*]] = call float @returns_positive_or_nan()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[MUST_BE_POSITIVE_OR_NAN0]], float [[MUST_BE_POSITIVE_OR_NAN1]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float 0x7FF8000000000000
 ;
   %must.be.positive.or.nan0 = call float @returns_positive_or_nan()
   %must.be.positive.or.nan1 = call float @returns_positive_or_nan()
@@ -352,7 +349,7 @@ define nofpclass(snan) float @cannot_fold_negative_or_zero__positive_or_zero_0()
 ; CHECK-LABEL: define nofpclass(snan) float @cannot_fold_negative_or_zero__positive_or_zero_0() {
 ; CHECK-NEXT:    [[MUST_BE_NEGATIVE_OR_ZERO:%.*]] = call float @returns_positive_or_zero()
 ; CHECK-NEXT:    [[MUST_BE_POSITIVE_OR_ZERO:%.*]] = call float @returns_negative_or_zero()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[MUST_BE_NEGATIVE_OR_ZERO]], float [[MUST_BE_POSITIVE_OR_ZERO]])
+; CHECK-NEXT:    [[RESULT:%.*]] = call nnan float @llvm.maximumnum.f32(float [[MUST_BE_NEGATIVE_OR_ZERO]], float [[MUST_BE_POSITIVE_OR_ZERO]])
 ; CHECK-NEXT:    ret float [[RESULT]]
 ;
   %must.be.negative.or.zero = call float @returns_positive_or_zero()
@@ -366,7 +363,7 @@ define nofpclass(snan) float @cannot_fold_negative_or_zero__positive_or_zero_1()
 ; CHECK-LABEL: define nofpclass(snan) float @cannot_fold_negative_or_zero__positive_or_zero_1() {
 ; CHECK-NEXT:    [[MUST_BE_NEGATIVE_OR_ZERO:%.*]] = call float @returns_positive_or_zero()
 ; CHECK-NEXT:    [[MUST_BE_POSITIVE_OR_ZERO:%.*]] = call float @returns_negative_or_zero()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[MUST_BE_POSITIVE_OR_ZERO]], float [[MUST_BE_NEGATIVE_OR_ZERO]])
+; CHECK-NEXT:    [[RESULT:%.*]] = call nnan float @llvm.maximumnum.f32(float [[MUST_BE_POSITIVE_OR_ZERO]], float [[MUST_BE_NEGATIVE_OR_ZERO]])
 ; CHECK-NEXT:    ret float [[RESULT]]
 ;
   %must.be.negative.or.zero = call float @returns_positive_or_zero()
@@ -398,8 +395,7 @@ define nofpclass(nsub) float @rhs_must_be_pinf_or_nan(float nofpclass(ninf norm
 define nofpclass(nsub) float @lhs_must_be_pinf(float %unknown, float nofpclass(nan ninf norm zero sub) %must.be.pinf) {
 ; CHECK-LABEL: define nofpclass(nsub) float @lhs_must_be_pinf(
 ; CHECK-SAME: float [[UNKNOWN:%.*]], float nofpclass(nan ninf zero sub norm) [[MUST_BE_PINF:%.*]]) {
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[MUST_BE_PINF]], float [[UNKNOWN]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float 0x7FF0000000000000
 ;
   %result = call float @llvm.maximumnum.f32(float %must.be.pinf, float %unknown)
   ret float %result
@@ -408,8 +404,7 @@ define nofpclass(nsub) float @lhs_must_be_pinf(float %unknown, float nofpclass(n
 define nofpclass(nsub) float @rhs_must_be_pinf(float nofpclass(nan ninf norm zero sub) %must.be.pinf, float %unknown) {
 ; CHECK-LABEL: define nofpclass(nsub) float @rhs_must_be_pinf(
 ; CHECK-SAME: float nofpclass(nan ninf zero sub norm) [[MUST_BE_PINF:%.*]], float [[UNKNOWN:%.*]]) {
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[UNKNOWN]], float [[MUST_BE_PINF]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float 0x7FF0000000000000
 ;
   %result = call float @llvm.maximumnum.f32(float %unknown, float %must.be.pinf)
   ret float %result
@@ -419,8 +414,7 @@ define nofpclass(nsub) float @rhs_must_be_pinf(float nofpclass(nan ninf norm zer
 define nofpclass(nsub) float @lhs_must_be_pinf_rhs_non_nan(float nofpclass(nan) %not.nan, float nofpclass(nan ninf norm zero sub) %must.be.pinf) {
 ; CHECK-LABEL: define nofpclass(nsub) float @lhs_must_be_pinf_rhs_non_nan(
 ; CHECK-SAME: float nofpclass(nan) [[NOT_NAN:%.*]], float nofpclass(nan ninf zero sub norm) [[MUST_BE_PINF:%.*]]) {
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[MUST_BE_PINF]], float [[NOT_NAN]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float 0x7FF0000000000000
 ;
   %result = call float @llvm.maximumnum.f32(float %must.be.pinf, float %not.nan)
   ret float %result
@@ -430,8 +424,7 @@ define nofpclass(nsub) float @lhs_must_be_pinf_rhs_non_nan(float nofpclass(nan)
 define nofpclass(nsub) float @rhs_must_be_pinf_lhs_non_nan(float nofpclass(nan ninf norm zero sub) %must.be.pinf, float nofpclass(nan) %not.nan) {
 ; CHECK-LABEL: define nofpclass(nsub) float @rhs_must_be_pinf_lhs_non_nan(
 ; CHECK-SAME: float nofpclass(nan ninf zero sub norm) [[MUST_BE_PINF:%.*]], float nofpclass(nan) [[NOT_NAN:%.*]]) {
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[NOT_NAN]], float [[MUST_BE_PINF]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float 0x7FF0000000000000
 ;
   %result = call float @llvm.maximumnum.f32(float %not.nan, float %must.be.pinf)
   ret float %result
@@ -460,7 +453,7 @@ define nofpclass(nsub) float @rhs_must_be_ninf_or_nan(float nofpclass(pinf norm
 define nofpclass(nsub) float @lhs_must_be_ninf(float %unknown, float nofpclass(nan pinf norm zero sub) %must.be.ninf) {
 ; CHECK-LABEL: define nofpclass(nsub) float @lhs_must_be_ninf(
 ; CHECK-SAME: float [[UNKNOWN:%.*]], float nofpclass(nan pinf zero sub norm) [[MUST_BE_NINF:%.*]]) {
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[MUST_BE_NINF]], float [[UNKNOWN]])
+; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[UNKNOWN]], float 0xFFF0000000000000)
 ; CHECK-NEXT:    ret float [[RESULT]]
 ;
   %result = call float @llvm.maximumnum.f32(float %must.be.ninf, float %unknown)
@@ -470,7 +463,7 @@ define nofpclass(nsub) float @lhs_must_be_ninf(float %unknown, float nofpclass(n
 define nofpclass(nsub) float @rhs_must_be_ninf(float nofpclass(nan pinf norm zero sub) %must.be.ninf, float %unknown) {
 ; CHECK-LABEL: define nofpclass(nsub) float @rhs_must_be_ninf(
 ; CHECK-SAME: float nofpclass(nan pinf zero sub norm) [[MUST_BE_NINF:%.*]], float [[UNKNOWN:%.*]]) {
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[UNKNOWN]], float [[MUST_BE_NINF]])
+; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[UNKNOWN]], float 0xFFF0000000000000)
 ; CHECK-NEXT:    ret float [[RESULT]]
 ;
   %result = call float @llvm.maximumnum.f32(float %unknown, float %must.be.ninf)
@@ -482,8 +475,7 @@ define nofpclass(nsub) float @rhs_must_be_ninf(float nofpclass(nan pinf norm zer
 define nofpclass(nsub) float @lhs_must_be_ninf_rhs_non_nan(float nofpclass(nan) %not.nan, float nofpclass(nan pinf norm zero sub) %must.be.ninf) {
 ; CHECK-LABEL: define nofpclass(nsub) float @lhs_must_be_ninf_rhs_non_nan(
 ; CHECK-SAME: float nofpclass(nan) [[NOT_NAN:%.*]], float nofpclass(nan pinf zero sub norm) [[MUST_BE_NINF:%.*]]) {
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[MUST_BE_NINF]], float [[NOT_NAN]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float [[NOT_NAN]]
 ;
   %result = call float @llvm.maximumnum.f32(float %must.be.ninf, float %not.nan)
   ret float %result
@@ -493,8 +485,7 @@ define nofpclass(nsub) float @lhs_must_be_ninf_rhs_non_nan(float nofpclass(nan)
 define nofpclass(nsub) float @rhs_must_be_ninf_lhs_non_nan(float nofpclass(nan pinf norm zero sub) %must.be.ninf, float nofpclass(nan) %not.nan) {
 ; CHECK-LABEL: define nofpclass(nsub) float @rhs_must_be_ninf_lhs_non_nan(
 ; CHECK-SAME: float nofpclass(nan pinf zero sub norm) [[MUST_BE_NINF:%.*]], float nofpclass(nan) [[NOT_NAN:%.*]]) {
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[NOT_NAN]], float [[MUST_BE_NINF]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float [[NOT_NAN]]
 ;
   %result = call float @llvm.maximumnum.f32(float %not.nan, float %must.be.ninf)
   ret float %result
@@ -803,7 +794,7 @@ define nofpclass(snan) float @unknown__maximumnum__not_nan(float %x, float nofpc
 define nofpclass(snan) float @not_nan__maximumnum__not_nan(float nofpclass(nan) %x, float nofpclass(nan) %y) {
 ; CHECK-LABEL: define nofpclass(snan) float @not_nan__maximumnum__not_nan(
 ; CHECK-SAME: float nofpclass(nan) [[X:%.*]], float nofpclass(nan) [[Y:%.*]]) {
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[X]], float [[Y]])
+; CHECK-NEXT:    [[RESULT:%.*]] = call nnan float @llvm.maximumnum.f32(float [[X]], float [[Y]])
 ; CHECK-NEXT:    ret float [[RESULT]]
 ;
   %result = call float @llvm.maximumnum.f32(float %x, float %y)
@@ -834,7 +825,7 @@ define nofpclass(snan) float @known_positive__maximumnum__only_zero() {
 ; CHECK-LABEL: define nofpclass(snan) float @known_positive__maximumnum__only_zero() {
 ; CHECK-NEXT:    [[KNOWN_POSITIVE:%.*]] = call float @returns_positive()
 ; CHECK-NEXT:    [[KNOWN_ZERO:%.*]] = call float @returns_zero()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[KNOWN_POSITIVE]], float [[KNOWN_ZERO]])
+; CHECK-NEXT:    [[RESULT:%.*]] = call nnan float @llvm.maximumnum.f32(float [[KNOWN_POSITIVE]], float [[KNOWN_ZERO]])
 ; CHECK-NEXT:    ret float [[RESULT]]
 ;
   %known.positive = call float @returns_positive()
@@ -847,7 +838,7 @@ define nofpclass(snan) float @only_zero__maximumnum__known_positive() {
 ; CHECK-LABEL: define nofpclass(snan) float @only_zero__maximumnum__known_positive() {
 ; CHECK-NEXT:    [[KNOWN_ZERO:%.*]] = call float @returns_zero()
 ; CHECK-NEXT:    [[KNOWN_POSITIVE:%.*]] = call float @returns_positive()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[KNOWN_ZERO]], float [[KNOWN_POSITIVE]])
+; CHECK-NEXT:    [[RESULT:%.*]] = call nnan float @llvm.maximumnum.f32(float [[KNOWN_ZERO]], float [[KNOWN_POSITIVE]])
 ; CHECK-NEXT:    ret float [[RESULT]]
 ;
   %known.zero = call float @returns_zero()
@@ -912,8 +903,7 @@ define nofpclass(snan) float @known_positive__maximumnum__only_nzero() {
 ; CHECK-LABEL: define nofpclass(snan) float @known_positive__maximumnum__only_nzero() {
 ; CHECK-NEXT:    [[KNOWN_POSITIVE:%.*]] = call float @returns_positive()
 ; CHECK-NEXT:    [[KNOWN_NZERO:%.*]] = call float @returns_nzero()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[KNOWN_POSITIVE]], float [[KNOWN_NZERO]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float [[KNOWN_POSITIVE]]
 ;
   %known.positive = call float @returns_positive()
   %known.nzero = call float @returns_nzero()
@@ -925,8 +915,7 @@ define nofpclass(snan) float @only_nzero__maximumnum__known_positive() {
 ; CHECK-LABEL: define nofpclass(snan) float @only_nzero__maximumnum__known_positive() {
 ; CHECK-NEXT:    [[KNOWN_NZERO:%.*]] = call float @returns_nzero()
 ; CHECK-NEXT:    [[KNOWN_POSITIVE:%.*]] = call float @returns_positive()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[KNOWN_NZERO]], float [[KNOWN_POSITIVE]])
-; CHECK-NEXT:    ret float [[RESULT]]
+; CHECK-NEXT:    ret float [[KNOWN_POSITIVE]]
 ;
   %known.nzero = call float @returns_nzero()
   %known.positive = call float @returns_positive()
@@ -938,7 +927,7 @@ define nofpclass(snan) float @known_positive__maximumnum__only_pzero() {
 ; CHECK-LABEL: define nofpclass(snan) float @known_positive__maximumnum__only_pzero() {
 ; CHECK-NEXT:    [[KNOWN_POSITIVE:%.*]] = call float @returns_positive()
 ; CHECK-NEXT:    [[KNOWN_PZERO:%.*]] = call float @returns_pzero()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[KNOWN_POSITIVE]], float [[KNOWN_PZERO]])
+; CHECK-NEXT:    [[RESULT:%.*]] = call nnan float @llvm.maximumnum.f32(float [[KNOWN_POSITIVE]], float 0.000000e+00)
 ; CHECK-NEXT:    ret float [[RESULT]]
 ;
   %known.positive = call float @returns_positive()
@@ -951,7 +940,7 @@ define nofpclass(snan) float @only_pzero__maximumnum__known_positive() {
 ; CHECK-LABEL: define nofpclass(snan) float @only_pzero__maximumnum__known_positive() {
 ; CHECK-NEXT:    [[KNOWN_PZERO:%.*]] = call float @returns_pzero()
 ; CHECK-NEXT:    [[KNOWN_POSITIVE:%.*]] = call float @returns_positive()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float [[KNOWN_PZERO]], float [[KNOWN_POSITIVE]])
+; CHECK-NEXT:    [[RESULT:%.*]] = call nnan float @llvm.maximumnum.f32(float [[KNOWN_POSITIVE]], float 0.000000e+00)
 ; CHECK-NEXT:    ret float [[RESULT]]
 ;
   %known.pzero = call float @returns_pzero()
@@ -1259,8 +1248,7 @@ define nofpclass(snan) float @known_always_positive__maximumnum__known_always_ne
 ; CHECK-LABEL: define nofpclass(snan) float @known_always_positive__maximumnum__known_always_negative_or_nan() {
 ; CHECK-NEXT:    [[KNOWN_POSITIVE:%.*]] = call float @returns_positive()
 ; CHECK-NEXT:    [[KNOWN_NEGATIVE_OR_NAN:%.*]] = call float @returns_negative_or_nan()
-; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.maximumnum.f32(float ...
[truncated]

@arsenm arsenm force-pushed the users/arsenm/instcombine/simplify-demanded-fpclass-minimumnum-maximumnum branch from 86aace1 to c843519 Compare December 30, 2025 18:40
@arsenm arsenm force-pushed the users/arsenm/instcombine/add-baseline-tests-simplifydemandedfpclass-minimumnum-maximumnum branch 2 times, most recently from 2118850 to ba38a1e Compare December 30, 2025 18:46
@arsenm arsenm force-pushed the users/arsenm/instcombine/simplify-demanded-fpclass-minimumnum-maximumnum branch 2 times, most recently from 13aa5d0 to c16480d Compare December 30, 2025 21:46
@arsenm arsenm force-pushed the users/arsenm/instcombine/add-baseline-tests-simplifydemandedfpclass-minimumnum-maximumnum branch 2 times, most recently from 731dc7d to e812bfa Compare December 31, 2025 09:45
@arsenm arsenm force-pushed the users/arsenm/instcombine/simplify-demanded-fpclass-minimumnum-maximumnum branch from c16480d to 5faaa86 Compare December 31, 2025 09:45
@arsenm arsenm force-pushed the users/arsenm/instcombine/add-baseline-tests-simplifydemandedfpclass-minimumnum-maximumnum branch from e812bfa to f746146 Compare January 5, 2026 10:04
@arsenm arsenm force-pushed the users/arsenm/instcombine/simplify-demanded-fpclass-minimumnum-maximumnum branch from 5faaa86 to f8ecc3c Compare January 5, 2026 10:04
@arsenm arsenm force-pushed the users/arsenm/instcombine/add-baseline-tests-simplifydemandedfpclass-minimumnum-maximumnum branch from f746146 to 89d4b37 Compare January 6, 2026 12:35
@arsenm arsenm force-pushed the users/arsenm/instcombine/simplify-demanded-fpclass-minimumnum-maximumnum branch from f8ecc3c to 8a5f218 Compare January 6, 2026 12:35
@github-actions
Copy link

github-actions bot commented Jan 6, 2026

🪟 Windows x64 Test Results

  • 129214 tests passed
  • 2845 tests skipped

✅ The build succeeded and all tests passed.

@arsenm arsenm force-pushed the users/arsenm/instcombine/simplify-demanded-fpclass-minimumnum-maximumnum branch from 8a5f218 to ce99f7b Compare January 6, 2026 20:34
@arsenm arsenm force-pushed the users/arsenm/instcombine/add-baseline-tests-simplifydemandedfpclass-minimumnum-maximumnum branch from 89d4b37 to 1612f5d Compare January 6, 2026 20:34
@arsenm arsenm force-pushed the users/arsenm/instcombine/simplify-demanded-fpclass-minimumnum-maximumnum branch from ce99f7b to a691454 Compare January 7, 2026 12:14
@arsenm arsenm force-pushed the users/arsenm/instcombine/add-baseline-tests-simplifydemandedfpclass-minimumnum-maximumnum branch from 1612f5d to 079133f Compare January 7, 2026 12:14
Base automatically changed from users/arsenm/instcombine/add-baseline-tests-simplifydemandedfpclass-minimumnum-maximumnum to users/arsenm/instcombine/simplify-demanded-fpclass-minimum-maximum January 7, 2026 17:43
Base automatically changed from users/arsenm/instcombine/simplify-demanded-fpclass-minimum-maximum to main January 7, 2026 18:35
@arsenm arsenm force-pushed the users/arsenm/instcombine/simplify-demanded-fpclass-minimumnum-maximumnum branch from a691454 to c7a3440 Compare January 7, 2026 18:50
@github-actions
Copy link

github-actions bot commented Jan 7, 2026

🐧 Linux x64 Test Results

  • 167769 tests passed
  • 2971 tests skipped
  • 1 test failed

Failed Tests

(click on a test name to see its output)

lld

lld.COFF/linkreprofullpathrsp.test
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
rm -rf /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.obj
# executed command: rm -rf /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.obj
# note: command had no output on stdout or stderr
# RUN: at line 4
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/yaml2obj /home/gha/actions-runner/_work/llvm-project/llvm-project/lld/test/COFF/Inputs/hello32.yaml -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.obj
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/yaml2obj /home/gha/actions-runner/_work/llvm-project/llvm-project/lld/test/COFF/Inputs/hello32.yaml -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.obj
# note: command had no output on stdout or stderr
# RUN: at line 5
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/yaml2obj /home/gha/actions-runner/_work/llvm-project/llvm-project/lld/test/COFF/Inputs/empty.yaml -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.archive.obj
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/yaml2obj /home/gha/actions-runner/_work/llvm-project/llvm-project/lld/test/COFF/Inputs/empty.yaml -o /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.archive.obj
# note: command had no output on stdout or stderr
# RUN: at line 6
rm -f /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.archive.lib
# executed command: rm -f /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.archive.lib
# note: command had no output on stdout or stderr
# RUN: at line 7
llvm-ar rcs /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.archive.lib /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.archive.obj
# executed command: llvm-ar rcs /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.archive.lib /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.archive.obj
# note: command had no output on stdout or stderr
# RUN: at line 8
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-pdbutil yaml2pdb /home/gha/actions-runner/_work/llvm-project/llvm-project/lld/test/COFF/Inputs/pdb-type-server-simple-ts.yaml -pdb /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.pdb
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-pdbutil yaml2pdb /home/gha/actions-runner/_work/llvm-project/llvm-project/lld/test/COFF/Inputs/pdb-type-server-simple-ts.yaml -pdb /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.pdb
# note: command had no output on stdout or stderr
# RUN: at line 12
mkdir -p /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.dir/build1
# executed command: mkdir -p /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.dir/build1
# note: command had no output on stdout or stderr
# RUN: at line 13
cd /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.dir/build1
# executed command: cd /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.dir/build1
# note: command had no output on stdout or stderr
# RUN: at line 14
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/lld-link /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.obj /home/gha/actions-runner/_work/llvm-project/llvm-project/lld/test/COFF/Inputs/std32.lib /subsystem:console /defaultlib:/home/gha/actions-runner/_work/llvm-project/llvm-project/lld/test/COFF/Inputs/library.lib   /libpath:/home/gha/actions-runner/_work/llvm-project/llvm-project/lld/test/COFF/Inputs /defaultlib:std64.lib ret42.lib /entry:main@0 /linkreprofullpathrsp:/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.rsp   /wholearchive:/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.archive.lib /out:/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.exe /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.pdb
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/lld-link /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.obj /home/gha/actions-runner/_work/llvm-project/llvm-project/lld/test/COFF/Inputs/std32.lib /subsystem:console /defaultlib:/home/gha/actions-runner/_work/llvm-project/llvm-project/lld/test/COFF/Inputs/library.lib /libpath:/home/gha/actions-runner/_work/llvm-project/llvm-project/lld/test/COFF/Inputs /defaultlib:std64.lib ret42.lib /entry:main@0 /linkreprofullpathrsp:/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.rsp /wholearchive:/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.archive.lib /out:/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.exe /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.pdb
# note: command had no output on stdout or stderr
# RUN: at line 17
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/lld/test/COFF/linkreprofullpathrsp.test --check-prefix=RSP -DT=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp -DP=/home/gha/actions-runner/_work/llvm-project/llvm-project/lld/test/COFF < /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.rsp
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/lld/test/COFF/linkreprofullpathrsp.test --check-prefix=RSP -DT=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp -DP=/home/gha/actions-runner/_work/llvm-project/llvm-project/lld/test/COFF
# note: command had no output on stdout or stderr
# RUN: at line 19
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/lld-link @/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.rsp /out:/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp2.exe /entry:main@0
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/lld-link @/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.rsp /out:/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp2.exe /entry:main@0
# note: command had no output on stdout or stderr
# RUN: at line 20
diff /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.exe /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp2.exe
# executed command: diff /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.exe /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp2.exe
# .---command stdout------------
# | --- /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp.exe
# | +++ /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/COFF/Output/linkreprofullpathrsp.test.tmp2.exe
# | @@ -1,2 +1,2 @@
# | -MZx@x\xba\xb4	\xcd!\xb8L\xcd!This program cannot be run in DOS mode.$PEL?\xad^i\xe0
# | @P@\x85 (@4 
# | .text/ `.rdataf @@.data0@\xc0.reloc@
# | +MZx@x\xba\xb4	\xcd!\xb8L\xcd!This program cannot be run in DOS mode.$PEL@\xad^i\xe0
# | @P@\x85 (@4 
# | .text/ `.rdataf @@.data0@\xc0.reloc@
# |  @B3\xdbS\x8d0@P\x8d0@PS\xe8P\xe8\xcc\xcc\xcc1\xc0\xc3\xff%4 @\xff%8 @\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc( \ 4 @ N @ N ExitProcessMessageBoxAstd32.dllHelloHello World!0
# | 0%0+0
# `-----------------------------
# error: command failed with exit status: 1

--

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the infrastructure label.

Copy link
Member

@dtcxzyw dtcxzyw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

@arsenm arsenm force-pushed the users/arsenm/instcombine/simplify-demanded-fpclass-minimumnum-maximumnum branch from c7a3440 to ed7c9e4 Compare January 10, 2026 16:44
@arsenm arsenm enabled auto-merge (squash) January 10, 2026 16:44
@arsenm arsenm merged commit 5d501d1 into main Jan 10, 2026
9 of 10 checks passed
@arsenm arsenm deleted the users/arsenm/instcombine/simplify-demanded-fpclass-minimumnum-maximumnum branch January 10, 2026 17:21
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jan 10, 2026

LLVM Buildbot has detected a new failure on builder sanitizer-x86_64-linux-fast running on sanitizer-buildbot3 while building llvm at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/169/builds/18830

Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:561: note: using lld-link: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:561: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:561: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:561: note: using ld.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:561: note: using lld-link: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:561: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:561: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/main.py:74: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 95229 tests, 64 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.
FAIL: LLVM :: ExecutionEngine/JITLink/x86-64/MachO_archive_load_hidden_expect_failure.s (73503 of 95229)
******************** TEST 'LLVM :: ExecutionEngine/JITLink/x86-64/MachO_archive_load_hidden_expect_failure.s' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
rm -rf /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp && mkdir -p /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp
# executed command: rm -rf /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp
# note: command had no output on stdout or stderr
# executed command: mkdir -p /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp
# note: command had no output on stdout or stderr
# RUN: at line 2
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-mc -triple x86_64-apple-macosx10.9 -filetype=obj    -o /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp/MachO_extra_def_strong.o /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/Inputs/MachO_extra_def_strong.s
# executed command: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-mc -triple x86_64-apple-macosx10.9 -filetype=obj -o /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp/MachO_extra_def_strong.o /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/Inputs/MachO_extra_def_strong.s
# note: command had no output on stdout or stderr
# RUN: at line 4
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-ar crs /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp/libExtraDef.a /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp/MachO_extra_def_strong.o
# executed command: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-ar crs /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp/libExtraDef.a /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp/MachO_extra_def_strong.o
# note: command had no output on stdout or stderr
# RUN: at line 5
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-mc -triple x86_64-apple-macosx10.9 -filetype=obj    -o /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp/MachO_archive_load_hidden_support.o /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_archive_load_hidden_expect_failure.s
# executed command: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-mc -triple x86_64-apple-macosx10.9 -filetype=obj -o /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp/MachO_archive_load_hidden_support.o /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_archive_load_hidden_expect_failure.s
# note: command had no output on stdout or stderr
# RUN: at line 7
not /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-jitlink -noexec /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp/MachO_archive_load_hidden_support.o -lFoo    -jd Foo -L/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp -hidden-lExtraDef
# executed command: not /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-jitlink -noexec /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp/MachO_archive_load_hidden_support.o -lFoo -jd Foo -L/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp -hidden-lExtraDef
# .---command stderr------------
# | llvm-jitlink error: Symbols not found: [ ExtraDef ]
# | libc++abi: Pure virtual function called!
# `-----------------------------
# error: command failed with exit status: 1

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Slowest Tests:
--------------------------------------------------------------------------
Step 10 (stage2/asan_ubsan check) failure: stage2/asan_ubsan check (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:561: note: using lld-link: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:561: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:561: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:561: note: using ld.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:561: note: using lld-link: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:561: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:561: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/main.py:74: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 95229 tests, 64 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.
FAIL: LLVM :: ExecutionEngine/JITLink/x86-64/MachO_archive_load_hidden_expect_failure.s (73503 of 95229)
******************** TEST 'LLVM :: ExecutionEngine/JITLink/x86-64/MachO_archive_load_hidden_expect_failure.s' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
rm -rf /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp && mkdir -p /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp
# executed command: rm -rf /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp
# note: command had no output on stdout or stderr
# executed command: mkdir -p /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp
# note: command had no output on stdout or stderr
# RUN: at line 2
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-mc -triple x86_64-apple-macosx10.9 -filetype=obj    -o /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp/MachO_extra_def_strong.o /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/Inputs/MachO_extra_def_strong.s
# executed command: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-mc -triple x86_64-apple-macosx10.9 -filetype=obj -o /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp/MachO_extra_def_strong.o /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/Inputs/MachO_extra_def_strong.s
# note: command had no output on stdout or stderr
# RUN: at line 4
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-ar crs /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp/libExtraDef.a /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp/MachO_extra_def_strong.o
# executed command: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-ar crs /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp/libExtraDef.a /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp/MachO_extra_def_strong.o
# note: command had no output on stdout or stderr
# RUN: at line 5
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-mc -triple x86_64-apple-macosx10.9 -filetype=obj    -o /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp/MachO_archive_load_hidden_support.o /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_archive_load_hidden_expect_failure.s
# executed command: /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-mc -triple x86_64-apple-macosx10.9 -filetype=obj -o /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp/MachO_archive_load_hidden_support.o /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_archive_load_hidden_expect_failure.s
# note: command had no output on stdout or stderr
# RUN: at line 7
not /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-jitlink -noexec /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp/MachO_archive_load_hidden_support.o -lFoo    -jd Foo -L/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp -hidden-lExtraDef
# executed command: not /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-jitlink -noexec /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp/MachO_archive_load_hidden_support.o -lFoo -jd Foo -L/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/MachO_archive_load_hidden_expect_failure.s.tmp -hidden-lExtraDef
# .---command stderr------------
# | llvm-jitlink error: Symbols not found: [ ExtraDef ]
# | libc++abi: Pure virtual function called!
# `-----------------------------
# error: command failed with exit status: 1

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Slowest Tests:
--------------------------------------------------------------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

floating-point Floating-point math llvm:analysis Includes value tracking, cost tables and constant folding llvm:instcombine Covers the InstCombine, InstSimplify and AggressiveInstCombine passes llvm:support llvm:transforms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants