[llvm] [InstCombine] Fold `ceil(X / (2 ^ C)) == 0` -> `X == 0` (PR #143683)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 21 02:59:19 PDT 2025


================
@@ -3544,6 +3544,9 @@ bool isKnownNonZero(const Value *V, const APInt &DemandedElts,
       isKnownNonNullFromDominatingCondition(V, Q.CxtI, Q.DT))
     return true;
 
+  if (const Value *Stripped = stripNullTest(V))
+    return isKnownNonZero(Stripped, DemandedElts, Q, Depth + 1);
----------------
dtcxzyw wrote:

```suggestion
    return isKnownNonZero(Stripped, DemandedElts, Q, Depth);
```

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


More information about the llvm-commits mailing list