[llvm] [InstCombine] Improve `foldAndOrOfICmpsUsingRanges` (PR #67327)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 19:22:31 PDT 2023


dtcxzyw wrote:

> This looks like something that should be handled in foldLogOpOfMaskedICmps()? Why is this in foldAndOrOfICmpsUsingRanges()?

Because the following equivalent form is handled in `foldAndOrOfICmpsUsingRanges`:
```
define i1 @isFloat2(i64 %0) {
  %a = and i64 %0, -281474976710656
  %cmp1 = icmp ne i64 %a, 0
  %cmp2 = icmp ne i64 %a, 281474976710656
  %res = and i1 %cmp1, %cmp2
  ret i1 %res
}
```
godbolt: https://godbolt.org/z/j7YYhGPzr



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


More information about the llvm-commits mailing list