Issue 132503
Summary Inconsistency in sinh(const), cosh(const), and tanh(const) optimizations with -ffast-math
Labels new issue
Assignees
Reporter k-arrows
    Consider the following test case.
https://godbolt.org/z/Ecd865P97
```cpp
#include <cmath>

double f1() {
  return std::sinh(0.);
}

double f2() {
  return std::cosh(0.);
}

double f3() {
  return std::tanh(0.);
}
```

The optimization results for `std::sinh(0.)`, `std::cosh(0.)`, and `std::tanh(0.)` differ between `-O1` and `-O1 -ffast-math`. Specifically, when `-ffast-math` is enabled, `sinh(0.)` and `cosh(0.)` are not folded into constants but instead call the corresponding library functions. This suggests that `-ffast-math` is restricting optimization rather than enhancing it.

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

Reply via email to