[llvm] [InstCombine] Fold zext(i1) == lshr(A, BW - 1) => i1 == A s< 0 (PR #68244)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 12 00:32:31 PDT 2023


sftlbcn wrote:

worth handling other predicates?
https://alive2.llvm.org/ce/z/EJAH6Z

```
define i1 @src(i1 %x, i32 %y) {
  %zx = zext i1 %x to i32
  %cmp1 = lshr i32 %y, 31
  %cmp2 = icmp ule i32 %cmp1, %zx
  ret i1 %cmp2
}
define i1 @tgt(i1 %x, i32 %y) {
  %cmp1 = icmp slt i32 %y, 0
  %cmp2 = icmp ule i1 %cmp1, %x
  ret i1 %cmp2
}
```

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


More information about the llvm-commits mailing list