[llvm-branch-commits] [llvm] ValueTracking: Improve frexp known range from dominating conditions (PR #206927)

Yingwei Zheng via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Jul 5 09:56:01 PDT 2026


================
@@ -4867,6 +4867,50 @@ static void computeKnownFPClassFromCond(const Value *V, Value *Cond,
   }
 }
 
+/// Compute the minimum and maximum values (inclusive) for the exponent of \p V,
+/// assuming it is not nan.
+static std::pair<int, int>
+computeKnownExponentRangeFromContext(const Value *V, const SimplifyQuery &Q) {
+  if (!Q.CxtI || !Q.DC || !Q.DT)
+    return {APFloat::IEK_NaN, APFloat::IEK_Inf};
+
+  for (CondBrInst *BI : Q.DC->conditionsFor(V)) {
+    const Value *A;
+    CmpPredicate Pred;
+    const APFloat *LimitC;
+    if (!match(BI->getCondition(),
+               m_FCmp(Pred, m_FAbs(m_Value(A)), m_Finite(LimitC))))
----------------
dtcxzyw wrote:

```suggestion
               m_FCmp(Pred, m_FAbs(m_Specific(V)), m_Finite(LimitC))))
```


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


More information about the llvm-branch-commits mailing list