Skip to content

Missing fold (X == 0) | (trunc nuw X to i1) -> true #134093

Open
@dtcxzyw

Description

@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 #132678. cc @scottmcm
See also dtcxzyw/llvm-opt-benchmark#2234 (comment).

I don't know how to generalize this :(

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions