[llvm-branch-commits] [llvm] ValueTracking: Avoid unnecessary denormal mode lookup for fadd (PR #174272)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat Jan 3 02:27:50 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
@llvm/pr-subscribers-llvm-analysis
Author: Matt Arsenault (arsenm)
<details>
<summary>Changes</summary>
The mode was already queried, so don't do it again.
---
Full diff: https://github.com/llvm/llvm-project/pull/174272.diff
1 Files Affected:
- (modified) llvm/lib/Analysis/ValueTracking.cpp (+4-8)
``````````diff
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);
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/174272
More information about the llvm-branch-commits
mailing list