| Issue |
63316
|
| Summary |
Instcombine incorrectly optimizes `fcmp uno`
|
| Labels |
|
| Assignees |
|
| Reporter |
DaniilSuchkov
|
After this commit: https://github.com/llvm/llvm-project/commit/e47b76a82a0300900dbf3c2d3a50552a76305a8c running `opt -passes=instcombine` on the following IR:
```
define i1 @test(i64 %arg) {
%sitofp = sitofp i64 %arg to float
%fmul = fmul float %sitofp, 0x7FF0000000000000
%fcmp = fcmp uno float %fmul, 0.000000e+00
ret i1 %fcmp
}
```
results in
```
define i1 @test(i64 %arg) {
ret i1 false
}
```
That's not correct because `fcmp uno` returns true if either argument is NaN and by IEEE-754 multiplication of infinity (aka `0x7FF0000000000000`) and 0 (`sitofp i64 %arg to float` with `%arg == 0`) is NaN. Alive2 points out exactly this case: https://alive2.llvm.org/ce/z/5rPFgH
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs