| Issue |
177605
|
| Summary |
select(fcmp nnan one, ...) optimization does not trigger when RHS is 0
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
ariskeirio
|
I observed that in LLVM, the pattern:
```Markdown
define float @src(float %x) {
%fcmp = fcmp nnan one float %x, 6.0
%fsub = fsub float %x, 2.0
%sel = select i1 %fcmp, float 2.0, float %fsub
ret float %sel
}
```
can be optimized to:
```Markdown
define float @tgt(float %x) {
%fcmp = fcmp nnan one float %x, 6.000000e+00
%sel = select i1 %fcmp, float 2.000000e+00, float 4.000000e+00
ret float %sel
}
```
However, when the right-hand side of the `fcmp` is 0, this optimization does not happen
```Markdown
define float @src(float %x) {
%fcmp = fcmp nnan one float %x, 0.0
%fsub = fsub float %x, 2.0
%sel = select i1 %fcmp, float 2.0, float %fsub
ret float %sel
}
```
This src will not be optimized to the following tgt
```Markdown
define float @tgt(float %x) {
%fcmp = fcmp nnan one float %x, 0.000000e+00
%sel = select i1 %fcmp, float 2.000000e+00, float -2.000000e+00
ret float %sel
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs