Issue 140994
Summary [InstCombine] `(fcmp une T, F) ? T : F --> T` should not rely on the nsz flag on fcmp
Labels miscompilation, llvm:instcombine, floating-point
Assignees dtcxzyw
Reporter dtcxzyw
    Reproducer: https://alive2.llvm.org/ce/z/_FgncC
```
define double @src(double %x, double %y) {
  %cmp = fcmp nsz une double %x, %y
  %cond = select i1 %cmp, double %x, double %y
  ret double %cond
}

define double @tgt(double returned %x, double %y) {
  ret double %x
}
```
```
Transformation doesn't verify!

ERROR: Value mismatch

Example:
double %x = #x8000000000000000 (-0.0)
double %y = #x0000000000000000 (+0.0)

Source:
i1 %cmp = #x0 (0)
double %cond = #x0000000000000000 (+0.0)

Target:
Source value: #x0000000000000000 (+0.0)
Target value: #x8000000000000000 (-0.0)
```
`nsz` flag should not be propagated from fcmp into select.

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

Reply via email to