Skip to content

[InstCombine] ninf should not be propagated when folding fcmp pred, x - y, 0 to fcmp pred, x, y #161525

@dtcxzyw

Description

@dtcxzyw

Reproducer: https://alive2.llvm.org/ce/z/ZHW6-B

; bin/opt -passes=instcombine test.ll -S
define i1 @src1(float %x, float %y) {
  %fs = fsub float %x, %y
  %cmp = fcmp ninf ule float %fs, 0.000000e+00
  ret i1 %cmp
}
=>
define i1 @src1(float %x, float %y) {
#0:
  %cmp = fcmp ninf ule float %x, %y
  ret i1 %cmp
}
Transformation doesn't verify!

ERROR: Target is more poisonous than source

Example:
float %x = #x7f800000 (+oo)
float %y = #x7f800080 (SNaN)

Source:
float %fs = #xffc00003 (QNaN)
i1 %cmp = #x1 (1)

Target:
i1 %cmp = poison
Source value: #x1 (1)
Target value: poison

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions