[llvm] [InstCombine] Canonicalize (a + 1 == 0) ? -1 : a + 1 -> uadd.sat(a, 1) (PR #144566)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 17 12:00:46 PDT 2025


topperc wrote:

I don't think this is the right place to fix this. We need to rewrite

```
  %add = add i32 %num, 1
  %cmp = icmp eq i32 %add, 0
```

to

```
  %cmp = icmp eq i32 %num, -1
```

Then the rest just works.

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


More information about the llvm-commits mailing list