Skip to content

[InstCombine] Wrong folding of is.fpclass + minnum #157238

@dtcxzyw

Description

@dtcxzyw

Reproducer: https://alive2.llvm.org/ce/z/zTqnNp

; bin/opt -passes=instcombine test.ll -S
define i1 @src(i32 %x) {
entry:
  %or102.i.i = or i32 %x, -5938
  %0 = bitcast i32 %or102.i.i to float
  %1 = call float @llvm.minnum.f32(float %0, float 0.000000e+00)
  %tobool106.not2.i.i = call i1 @llvm.is.fpclass.f32(float %1, i32 64)
  ret i1 %tobool106.not2.i.i
}

----------------------------------------
define i1 @src(i32 %x) {
entry:
  %or102.i.i = or i32 %x, 4294961358
  %#0 = bitcast i32 %or102.i.i to float
  %#1 = fmin float %#0, 0.000000
  %tobool106.not2.i.i = is.fpclass float %#1, i32 64
  ret i1 %tobool106.not2.i.i
}
=>
define i1 @src(i32 %x) nofree noundef willreturn memory(none) {
entry:
  ret i1 0
}
Transformation doesn't verify!

ERROR: Value mismatch

Example:
i32 %x = #x00000000 (0)

Source:
i32 %or102.i.i = #xffffe8ce (4294961358, -5938)
float %#0 = #xffffe8ce (QNaN)
float %#1 = #x00000000 (+0.0)
i1 %tobool106.not2.i.i = #x1 (1)

Target:
Source value: #x1 (1)
Target value: #x0 (0)

Summary:
  0 correct transformations
  1 incorrect transformations
  0 failed-to-prove transformations
  0 Alive2 errors

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions