Issue 143123
Summary [InstCombine] fcmp is incorrectly inverted
Labels miscompilation, llvm:instcombine, floating-point, generated by fuzzer
Assignees dtcxzyw
Reporter dtcxzyw
    Reproducer: https://alive2.llvm.org/ce/z/yVw9wM
```
define float @src(float %x) {
 %cmp = fcmp olt float %x, 0.000000e+00
  %sel = select nnan nsz i1 %cmp, float %x, float -0.000000e+00
  ret float %sel
}

define float @tgt(float %x) {
  %.inv = fcmp oge float %x, 0.000000e+00
  %sel1 = select i1 %.inv, float -0.000000e+00, float %x
  ret float %sel1
}
```
```
----------------------------------------
define float @src(float %x) {
#0:
  %cmp = fcmp olt float %x, 0.000000
  %sel = select nnan nsz i1 %cmp, float %x, float -0.000000
  ret float %sel
}
=>
define float @tgt(float %x) {
#0:
  %.inv = fcmp oge float %x, 0.000000
  %sel1 = select i1 %.inv, float -0.000000, float %x
  ret float %sel1
}
Transformation doesn't verify!

ERROR: Value mismatch

Example:
float %x = #x7f800002 (SNaN)

Source:
i1 %cmp = #x0 (0)
float %sel = #x80000000 (-0.0)

Target:
i1 %.inv = #x0 (0)
float %sel1 = #x7f800002 (SNaN)
Source value: #x80000000 (-0.0)
Target value: #x7f800002 (SNaN)
```

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to