[llvm-branch-commits] [llvm] InstCombine: Introduce nsz flag on minimum/maximum in SimplifyDemandedFPClass (PR #173898)
Yingwei Zheng via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat Jan 3 01:26:47 PST 2026
================
@@ -2196,9 +2196,25 @@ Value *InstCombinerImpl::SimplifyDemandedUseFPClass(Value *V,
auto *FPOp = cast<FPMathOperator>(CI);
bool ChangedFlags = false;
+ if (!FPOp->hasNoSignedZeros()) {
+ // Add NSZ flag if we know the result will not be sensitive on the sign
+ // of 0.
+ FPClassTest ZeroMask = fcZero;
+
+ if (Mode != DenormalMode::getIEEE())
+ ZeroMask |= fcSubnormal;
+
+ bool ResultNotLogical0 = (ValidResults & ZeroMask) == fcNone;
+ if (ResultNotLogical0 ||
+ ((KnownLHS.isKnownNeverLogicalNegZero(Mode) ||
----------------
dtcxzyw wrote:
Wait for me a moment...
https://github.com/llvm/llvm-project/pull/173898
More information about the llvm-branch-commits
mailing list