Issue 154000
Summary Missed optimization: eliminate redundant range check
Labels new issue
Assignees
Reporter zxt5
    ```
define i1 @src(ptr %arg0) {
  %v0 = load i8, ptr %arg0, align 8
  %v1 = icmp ugt i8 %v0, 28
  %v2 = and i8 %v0, -2
 %v3 = icmp eq i8 %v2, 48
  %v4 = and i1 %v1, %v3
  ret i1 %v4
}

define i1 @tgt(ptr %arg0) {
  %v0 = load i8, ptr %arg0, align 8
  %v2 = and i8 %v0, -2
  %v3 = icmp eq i8 %v2, 48
  ret i1 %v3
}
```


Alive2: https://alive2.llvm.org/ce/z/PizgLm
Godbolt: https://godbolt.org/z/4aezssq38

Found the pattern in https://github.com/dtcxzyw/llvm-opt-benchmark/blob/main/bench/llvm/optimized/InstCombineCompares.ll
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to