[llvm] [ValueTracking] Fix incorrect inferrence about the signbit of sqrt (PR #92510)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Fri May 17 05:32:21 PDT 2024


================
@@ -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())
----------------
dtcxzyw wrote:

> I think we are missing handling of the nnan flag on the sqrt instruction itself

See https://github.com/llvm/llvm-project/blob/f5c8242042c959cbf476778e1d8a874fc8747801/llvm/include/llvm/Analysis/ValueTracking.h#L510-L527

https://github.com/llvm/llvm-project/pull/92510


More information about the llvm-commits mailing list