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

    <tr>
        <th>Summary</th>
        <td>
            [ValueTracking] Off-by-one in frexp exponent range inferred from dominating bounds
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            miscompilation
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          cardigan1008
      </td>
    </tr>
</table>

<pre>
    https://github.com/llvm/llvm-project/pull/206927 introduces a miscompilation: https://alive2.llvm.org/ce/z/jpkAUn

The patch infers `frexp`'s exponent upper bound as `ilogb(K)` from `fabs(x) <= K`, but for `K = 1.0`, the valid boundary input `x = 1.0` has `frexp` exponent 1 rather than 0, causing InstCombine to incorrectly fold `e <= 0` to true.

For more details, please refer to https://archer.top/pr/206927

cc @arsenm 

> Found with [Archer](https://github.com/cuhk-s3/Archer). Please let me know if anything is wrong.

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUk0GPpDYQhX9NcSk1MkVDw4FD73SQojkkh03uxhTgbWMj2_R059dH0Ls7mTlE2hMSLn-uevWeDEGPlrmB4gsUl0SucXK-UdL3epQ2E6JKOtc_minGJUB-BmqB2lHHae1S5Wag1pjbj89h8e4bqwjULqsxQC2JsqYTahu961fFASXOOig3L9rIqJ2F_Iwf6dLoG1O6AVPnR6BWMVD7D1D7bbme_7IgziDOXyfGRUY1obYD-4BQisHzfYFSAJ0C8n1xlm3EdVnYY-dW26Pc67RxYwdUvQLVUAocvJv3-7ILQNUdqEbIXyC_4OuOe8FujTg4v1W94naQpeL7UZwYb9Lo_vmG9A_UdlnjVnv_Ty1O8kOX7x1m6GWc2GOcpMUdquQatB3xdxvii5s7bRmjQ22V855VNA8cnOk3Hv_odX8kOox-5fSpUus8zs4z9hylNmFDL4ZlYPQ8bC-6z_J7NbFPo1u2NfqfS3zylEI4CukD2xmfvyD_Ddtd3DcdJ4Tiy3lHQHEBqv7HOWqdroeQA7XfL1Cd4p_P5gxHnBmv1r2hHlDaR5w2OXTAN-_suI2X9E3e13ktE26yU5UXoiyKMpkaWQ40UMVFr7qszig7SsF1fxpkeeSuo0Q3JKgUJ1FlguqsTEVRKi7rajiVXab6Ao6CZ6nNTxcmOoSVGxJVVlNiZMcm7Kkh-uRnoi1JvtkD0a1jgKMwOsTwzoo6mj1zf0uz8lcv1VXbEYoL_jEMh-5xcJZRW9yN8u4SL-3IT7d77p-m7d2srYybNLv5QrJ68-tx3acL-673AW8N_RsAAP__iGdOFA">