[llvm] [KnownFPClass] Correct denormal mode handling for `KnownFPClass::minMaxLike` (PR #220148)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 13 07:53:43 PDT 2026
================
@@ -2258,6 +2258,13 @@ simplifyDemandedFPClassMinMax(KnownFPClass &Known, Intrinsic::ID IID,
KnownFPClass KnownLHS, KnownFPClass KnownRHS,
const Function &F, bool NSZ) {
bool OrderedZeroSign = !NSZ;
+ Type *EltTy = CI->getType()->getScalarType();
+ DenormalMode Mode = F.getDenormalMode(EltTy->getFltSemantics());
+ // Prevent folding of the operand if a subnormal output/input could flush to
+ // zero.
+ bool CanReturnOperand =
+ Mode == DenormalMode::getIEEE() ||
+ (KnownLHS.isKnownNeverSubnormal() && KnownRHS.isKnownNeverSubnormal());
----------------
arsenm wrote:
This doesn't feel like the right way to express this. "CanReturnOperand" is too mechanics focused, and not a logic/value adjustment to the existing checks
https://github.com/llvm/llvm-project/pull/220148
More information about the llvm-commits
mailing list