[llvm] [ConstraintElimination] Scale comparisons against exact right shifts (PR #223212)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 13 00:47:26 PDT 2026


dtcxzyw wrote:

> #169343 IIRC it was blocked by some regressions.

For example:
```
define i1 @precond_icmp_ashr_and_constant_regression(i64 %x) {
entry:
  %ashr = ashr exact i64 %x, 3
  %cond = icmp ugt i64 %ashr, 4
  call void @llvm.assume(i1 %cond)
  %add = add nsw i64 %ashr, -1
  %cmp = icmp eq i64 %add, 0
  ret i1 %cmp
}
```
With this patch we fail to simplify `%cmp` to false. See also https://github.com/dtcxzyw/llvm-opt-benchmark-nightly/pull/1294/commits/ba6610014be16a6c793907af2c79eae62d1fc40b for more bad cases.


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


More information about the llvm-commits mailing list