[llvm] [ConstraintElim] Add facts for sdiv with a positive divisor. (PR #225535)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 15:51:41 PDT 2026


================
@@ -1595,17 +1553,20 @@ void State::addInfoFor(BasicBlock &BB) {
     }
 
     // Add facts from unsigned division, remainder and logical shift right, and
-    // from signed remainder.
+    // from signed division and remainder.
     //   urem x, n: result < n  and  result <= x
     //   udiv x, n: result <= x
     //   lshr x, n: result <= x
     //   srem x, n: result >= 0 and result <= x, if x >= 0
     //              result < n,                  if n > 0
+    //   sdiv x, n: result >= 0 and result <= x, if x >= 0 and n > 0
+    //              result > 0 and result < x,   if x > 0 and n > 1
----------------
efriedma-quic wrote:

This doesn't look right.

I can see `result >= 0 and result < x,   if x >= 0 and n > 1`.  And `result > 0 and result < x, if x > n > 1`.

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


More information about the llvm-commits mailing list