<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/132503>132503</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Inconsistency in sinh(const), cosh(const), and tanh(const) optimizations with -ffast-math
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          k-arrows
      </td>
    </tr>
</table>

<pre>
    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.

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEVNGu2zYM_Rr5hYgh04njPPghvW2APXXA-gOyRMfaFCkQ6Qbp1w_KTbC66HCBAEJE8uiQ59CG2Z8j0aB2n9Tuc2UWmVMe_tmYnNONqzG5-_CWIntHGWQmmFII6ebjGYRYwBqmWunjLHJl1R4VnhSezsmNKUid8lnh6YfC0xfr-m7352Gv9FF1-v1nr9fyF1sfbVgcgWrf7MXIrNovJaCPLi1jIJgahb3CA6j9J6WPAJlkyRFYXHmzPbKPs8Je1woPqi05av95DYEfQNjEH0G0H0CI-R8Wr4bf4b7NBOkq_uJ_GPEpQiZegjBMKYPq9O-76rTCt1V4xfg9bKJbpawYdRqcnybKMJLciGJJ3XxtSuBZuPnawGaaDMvmoUOna_jrStZP3poQ7uWN2_ysXOWBZ6BoxkDuxXPN_vXEL6zBZIKYpBjLkQMfJYFNkcVEYRgXAR9ZyDgoDB4etCln4muKrvgw-DGbfIdpibaMk2v4NnsGXs5nYmGQ2cjvCWdiyd5KgVkrYmR-GN5EoDibaEuKl2L1yg2tO7QHU9HQ7LfYNYg9VvNg7Xa37_bb8aAbSw32h6nrtOtbbKnZuq7yA2rc6RbL0WusNfbthIijQ2y03aqtpovxoQ7h-6VsT-WZFxqatpRVwYwU-LGriJFu8IgqxLK6eShFm3E5s9rq4Fn4PxjxEmj4I5bBehaK9g4-wlOix7iLHPgGT3l-virCPY30ul5Ni-HmZf7ZN9WSw_DLJ8HLvIy1TReFp8LreWyuOf1NVhSeHt2wwtOz3e8D_hsAAP__du9qJg">