Skip to content

[InstCombine] ninf should not be preserved #161634

@dtcxzyw

Description

@dtcxzyw

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

; bin/opt -passes=instcombine test.ll -S
define float @select_fpclass_fadd(i1 %cond, float nofpclass(nan) %A, float %B) {
  %C = fadd float %A, %B
  %D = select ninf i1 %cond, float %C, float %A
  ret float %D
}
=>
define float @select_fpclass_fadd(i1 %cond, float nofpclass(3) %A, float %B) {
#0:
  %C = select ninf i1 %cond, float %B, float -0.000000
  %D = fadd float nofpclass(3) %A, %C
  ret float %D
}
Transformation doesn't verify!

ERROR: Target is more poisonous than source

Example:
i1 %cond = #x1 (1)
float nofpclass(3) %A = #xff800000 (-oo)
float %B = #x7f800000 (+oo)

Source:
float %C = #xffc00000 (QNaN)
float %D = #xffc00000 (QNaN)

Target:
float %C = poison
float %D = poison
Source value: #xffc00000 (QNaN)
Target value: poison

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions