Closed
Description
This optimization changes the NaN payload. It requires the nnan
flag.
; test/Transforms/InstCombine/select-binop-foldable-floating-point.ll
define float @select_fadd(i1 %cond, float %A, float %B) {
%C = fadd float %A, %B
%D = select i1 %cond, float %C, float %A
ret float %D
}
=>
define float @select_fadd(i1 %cond, float %A, float %B) {
%C = select i1 %cond, float %B, float -0.000000
%D = fadd float %C, %A
ret float %D
}
Transformation doesn't verify!
ERROR: Value mismatch
Example:
i1 %cond = #x0 (0)
float %A = #x7f810000 (SNaN)
float %B = #x00000000 (+0.0)
Source:
float %C = #x7fc00000 (QNaN)
float %D = #x7f810000 (SNaN)
Target:
float %C = #x80000000 (-0.0)
float %D = #x7fc00000 (QNaN)
Source value: #x7f810000 (SNaN)
Target value: #x7fc00000 (QNaN)