aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorYingwei Zheng <dtcxzyw2333@gmail.com>2024-05-20 21:52:38 +0800
committerGitHub <noreply@github.com>2024-05-20 21:52:38 +0800
commit04ae6e600a3090ccc1f80d0110a1108aa73a54f8 (patch)
tree67341424cec4d0387b277cbf3c27fbe6f88c38b8 /llvm/lib/Analysis/ValueTracking.cpp
parent36899d693d91719e7e6cd0f0ee4cf579111b8509 (diff)
downloadllvm-04ae6e600a3090ccc1f80d0110a1108aa73a54f8.zip
llvm-04ae6e600a3090ccc1f80d0110a1108aa73a54f8.tar.gz
llvm-04ae6e600a3090ccc1f80d0110a1108aa73a54f8.tar.bz2
[ValueTracking] Fix incorrect inferrence about the signbit of sqrt (#92510)
According to IEEE Std 754-2019, `sqrt` returns nan when the input is negative (except for -0). In this case, we cannot make assumptions about sign bit of the result. Fixes https://github.com/llvm/llvm-project/issues/92217
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 2d1486d..063162e 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -4940,11 +4940,8 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
// subnormal input could produce a negative zero output.
const Function *F = II->getFunction();
if (Q.IIQ.hasNoSignedZeros(II) ||
- (F && KnownSrc.isKnownNeverLogicalNegZero(*F, II->getType()))) {
+ (F && KnownSrc.isKnownNeverLogicalNegZero(*F, II->getType())))
Known.knownNot(fcNegZero);
- if (KnownSrc.isKnownNeverNaN())
- Known.signBitMustBeZero();
- }
break;
}