Issue 134093
Summary Missing fold `(X == 0) | (trunc nuw X to i1) -> true`
Labels llvm:optimizations, missed-optimization
Assignees
Reporter dtcxzyw
    Alive2: https://alive2.llvm.org/ce/z/RN4Sch
```
----------------------------------------
define i1 @src(i8 %x) {
#0:
  %cmp = icmp eq i8 %x, 0
  %trunc = trunc nuw i8 %x to i1
  %or = or i1 %cmp, %trunc
  ret i1 %or
}
=>
define i1 @tgt(i8 %x) {
#0:
  ret i1 1
}
Transformation seems to be correct!
```
It is a variant of https://github.com/llvm/llvm-project/issues/132678. cc @scottmcm
See also https://github.com/dtcxzyw/llvm-opt-benchmark/issues/2234#issuecomment-2772790195.

I don't know how to generalize this :(
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to