Skip to content

[CVP] Failure to recognise trunc nsw from assumptions #130100

Closed
@RKSimon

Description

@RKSimon

Pulled out of #130088

----------------------------------------
define i8 @src(i16 noundef %x) {
#0:
  %add = add i16 noundef %x, 128
  %or.cond.i = icmp ult i16 %add, 256
  assume i1 %or.cond.i
  %conv1 = trunc i16 noundef %x to i8
  ret i8 %conv1
}
=>
define i8 @tgt(i16 noundef %x) {
#0:
  %conv1 = trunc nsw i16 noundef %x to i8
  ret i8 %conv1
}
Transformation seems to be correct!

https://alive2.llvm.org/ce/z/2qhZy4

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