Skip to content

Failure to optimize based on umax implication #63896

Closed
@nikic

Description

@nikic

https://alive2.llvm.org/ce/z/o_8ch3

define i1 @src(i8 %x, i8 %y) {
  %max = call i8 @llvm.umax.i8(i8 %x, i8 1)
  %cmp = icmp ugt i8 %y, %max
  br i1 %cmp, label %if, label %end

if:
  %cmp2 = icmp ugt i8 %y, %x
  ret i1 %cmp2

end:
  ret i1 false
}

define i1 @tgt(i8 %x, i8 %y) {
  %max = call i8 @llvm.umax.i8(i8 %x, i8 1)
  %cmp = icmp ugt i8 %y, %max
  br i1 %cmp, label %if, label %end

if:
  ret i1 true

end:
  ret i1 false
}

declare i8 @llvm.umax.i8(i8, i8)

This might be either for ConstraintElimination or InstCombine.

For the case where icmp ugt i8 %y, 1 is used, CVP/LVI could also handle this.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions