Skip to content

[ConstraintElim] icmp spred x, y implies icmp samesign upred x, y #120089

@dtcxzyw

Description

@dtcxzyw

Alive2: https://alive2.llvm.org/ce/z/ZNNbj_

define i1 @src(i32 %x, i32 %y) {
entry:
  %cond = icmp sgt i32 %x, %y
  br i1 %cond, label %if.then, label %if.else

if.then:
  %cmp = icmp samesign ugt i32 %x, %y
  ret i1 %cmp

if.else:
  ret i1 false
}

define i1 @tgt(i32 %x, i32 %y) {
entry:
  %cond = icmp sgt i32 %x, %y
  br i1 %cond, label %if.then, label %if.else

if.then:
  ret i1 true

if.else:
  ret i1 false
}

We already perform similar optimizations in #115893.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions