Skip to content

[ConstraintElim] Failure to eliminate cmp of usub.sat #135557

Closed
@nikic

Description

@nikic

https://alive2.llvm.org/ce/z/4ZG-nD

define i1 @src(i64 %index, i64 %limit) {
  %precond = icmp ult i64 %index, %limit
  call void @llvm.assume(i1 %precond)
  %sub.sat = call i64 @llvm.usub.sat.i64(i64 %index, i64 1)
  %cmp = icmp ult i64 %sub.sat, %limit
  ret i1 %cmp
}

define i1 @tgt(i64 %index, i64 %limit) {
  ret i1 true
}

I think we should be able to handle this by adding a fact that the usub.sat result is ule its first argument, similar to what we do for min/max/abs.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions