[llvm] [InstCombine] Canonicalize more saturated-add variants (PR #100008)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 13:57:52 PDT 2024


topperc wrote:

Your proof has this

```
define dso_local i8 @src2(i8 %x, i8  %c) {
entry:
  %add = add i8 %x, %c
  %c.not = xor i8 %c, -1
  %d = sub nuw i8 %c.not, 1
  %cmp.not = icmp ugt i8 %x, %d
  %cond = select i1 %cmp.not, i8 -1, i8 %add
  ret i8 %cond
}
```

Which has an nuw on the sub. It fails without it. Your transform does not check this condition.

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


More information about the llvm-commits mailing list