https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/174272
The mode was already queried, so don't do it again. >From cfd3bea86a92959dfc1e804e5fb5596fa67183b1 Mon Sep 17 00:00:00 2001 From: Matt Arsenault <[email protected]> Date: Wed, 31 Dec 2025 17:40:48 +0100 Subject: [PATCH] ValueTracking: Avoid unnecessary denormal mode lookup for fadd The mode was already queried, so don't do it again. --- llvm/lib/Analysis/ValueTracking.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index d7d5daa348412..6b5792227a371 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -4728,12 +4728,6 @@ Intrinsic::ID llvm::getIntrinsicForCallSite(const CallBase &CB, return Intrinsic::not_intrinsic; } -static bool outputDenormalIsIEEEOrPosZero(const Function &F, const Type *Ty) { - Ty = Ty->getScalarType(); - DenormalMode Mode = F.getDenormalMode(Ty->getFltSemantics()); - return Mode.Output == DenormalMode::IEEE || - Mode.Output == DenormalMode::PositiveZero; -} /// Given an exploded icmp instruction, return true if the comparison only /// checks the sign bit. If it only checks the sign bit, set TrueIfSigned if /// the result of the comparison is true when the input value is signed. @@ -5671,7 +5665,8 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts, if ((KnownLHS.isKnownNeverLogicalNegZero(Mode) || KnownRHS.isKnownNeverLogicalNegZero(Mode)) && // Make sure output negative denormal can't flush to -0 - outputDenormalIsIEEEOrPosZero(*F, Op->getType())) + (Mode.Output == DenormalMode::IEEE || + Mode.Output == DenormalMode::PositiveZero)) Known.knownNot(fcNegZero); } else { if (!F) @@ -5685,7 +5680,8 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts, if ((KnownLHS.isKnownNeverLogicalNegZero(Mode) || KnownRHS.isKnownNeverLogicalPosZero(Mode)) && // Make sure output negative denormal can't flush to -0 - outputDenormalIsIEEEOrPosZero(*F, Op->getType())) + (Mode.Output == DenormalMode::IEEE || + Mode.Output == DenormalMode::PositiveZero)) Known.knownNot(fcNegZero); } } _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
