Issue |
143649
|
Summary |
Missed optimization: fold fcmp ord + select before fcmp one (x, C) into a single fcmp one (x, C)
|
Labels |
new issue
|
Assignees |
|
Reporter |
Cancelll
|
This is a follow-up issue of #142711
It seems having the last ```select``` instruction prevent the optimization.
```llvm
define double @src(double %arg0) {
%2 = fcmp ord double %arg0, 0.000000e+00
%3 = select i1 %2, double %arg0, double 0.000000e+00
%4 = call double @llvm.fabs.f64(double %3)
%5 = fcmp one double %4, 0x7FF0000000000000
%6 = select i1 %5, double %3, double 0.000000e+00
ret double %6
}
define double @tgt(double %arg0) {
%2 = call double @llvm.fabs.f64(double %arg0)
%3 = fcmp one double %2, 0x7FF0000000000000
%4 = select i1 %3, double %arg0, double 0.000000e+00
ret double %4
}
```
alive2: https://alive2.llvm.org/ce/z/G8UmjY
godbolt: https://godbolt.org/z/8sjT9P5TY
Found this pattern in
https://github.com/dtcxzyw/llvm-opt-benchmark/blob/013f9638352b38eb8f26daddafeeb0d87fc6510b/bench/typst-rs/optimized/4qskctz4kwc33g7b.ll
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs