Skip to content

[InstCombine] Param attributes should be swapped/dropped after swapping operands of commutative intrinsics #115890

@dtcxzyw

Description

@dtcxzyw
; bin/opt -passes=instcombine test.ll -S
define i32 @test(i32 %x) {
  %ret = call range(i32 -10, 0) i32 @llvm.umax.i32(i32 range(i32 -10, -8) -10, i32 %x)
  ret i32 %ret
}
define i32 @test(i32 %x) {
  %ret = call range(i32 -10, 0) i32 @llvm.umax.i32(i32 range(i32 -10, -8) %x, i32 -10)
  ret i32 %ret
}

I found this with https://github.com/dtcxzyw/llvm-ub-aware-interpreter.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions