Issue 113988
Summary Wrong simplification of nested `select` using an implied condition
Labels new issue
Assignees
Reporter bongjunj
    https://github.com/llvm/llvm-project/blob/1ceccbb0dd9d8539fec2213566fe6cc2a05b7993/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp#L2785-L2798

```llvm
----------------------------------------
define float @fmin_fmin_zero_mismatch.2(float %x) {
#0:
  %cmp1 = fcmp olt float %x, -0.000000
  %#1 = fmul float %x, 1.000000
  %min1 = select i1 %cmp1, float %#1, float 0.000000
  %cmp2 = fcmp olt float %min1, 0.000000
  %min2 = select i1 %cmp2, float %min1, float 0.000000
  ret float %min2
}
=>
define float @fmin_fmin_zero_mismatch.2(float %x) {
#0:
  %cmp1 = fcmp olt float %x, 0.000000
  %min2 = select i1 %cmp1, float %x, float 0.000000
  ret float %min2
}
Transformation doesn't verify!

ERROR: Value mismatch

Example:
float %x = undef

Source:
i1 %cmp1 = #x0 (0)      [based on undef value]
float %#1 = #x00000000 (+0.0)   [based on undef value]
float %min1 = #x00000000 (+0.0)
i1 %cmp2 = #x0 (0)
float %min2 = #x00000000 (+0.0)

Target:
i1 %cmp1 = #x1 (1)
float %min2 = #x7f801090 (SNaN)
Source value: #x00000000 (+0.0)
Target value: #x7f801090 (SNaN)

Summary:
  0 correct transformations
  1 incorrect transformations
  0 failed-to-prove transformations
  0 Alive2 errors
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to