[llvm-branch-commits] [llvm] ValueTracking: Improve sign bit handling for fdiv (PR #174652)

Yingwei Zheng via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jan 8 09:00:38 PST 2026


================
@@ -5694,8 +5694,9 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
                         fcNan | fcInf | fcZero | fcNegative, KnownRHS, Q,
                         Depth + 1);
 
-    bool KnowSomethingUseful =
-        KnownRHS.isKnownNeverNaN() || KnownRHS.isKnownNever(fcNegative);
+    bool KnowSomethingUseful = KnownRHS.isKnownNeverNaN() ||
+                               KnownRHS.isKnownNever(fcNegative) ||
+                               KnownRHS.isKnownNever(fcPositive);
 
     if (KnowSomethingUseful || WantPositive) {
       const FPClassTest InterestedLHS =
----------------
dtcxzyw wrote:

<!--__GRAPHITE_HTML_TAG_START__--><p class='graphite__hidden'><i>[Re: line +5704]</i></p><!--__GRAPHITE_HTML_TAG_END__-->
We should use `fcAllFlags` here. Otherwise, `KnownLHS.isKnownNever(fcPositive)` may be imprecise.
<!--__GRAPHITE_HTML_TAG_START__--><p class='graphite__hidden'>See this comment inline on <a href="https://app.graphite.com/github/pr/llvm/llvm-project/174652?utm_source=unchanged-line-comment">Graphite</a>.</p><!--__GRAPHITE_HTML_TAG_END__-->

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


More information about the llvm-branch-commits mailing list