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

    <tr>
        <th>Summary</th>
        <td>
            [CVP] Missed optimization for smax((a + 7) / 8, 1) where a s> 0
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            llvm:optimizations,
            missed-optimization
      </td>
    </tr>

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

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

<pre>
    Alive2 proof: https://alive2.llvm.org/ce/z/Cyoo2Y
Missed example: https://godbolt.org/z/9zW8PToPe

Real-world motivation: This snippet of IR is derived from FFmpeg/.../extr_aacdec.c_latm_decode_audio_specific_config.c (after O3 pipeline)
The example above is a reduced version. If you're interested in the original suboptimal IR and optimal IR. See also: https://godbolt.org/z/4a6K4b8hc

**Let me know if you can confirm that it's an optimization opportunity, thanks.**
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMU01vo0gQ_TXFpWQEBRh84ODYixTtrjbKRvtxspruwvSmoVF348T59StwZpKZuYyEQE1VvXrv8RDe6_PIXENxB8UxEnPorav_OfTXqLXqWu-NvjDh5KztINtjH8LkIdsDNUCNWKuxMZchtu4M1EgGat6AmsPVWvoXkiMk-9-196yQX8UwGf4R5mxVa014h1imd29_Vw9P9oFvALf7IwuzebHOKBxs0BcRtB0XtKdee_SjniYOaDu8f0TtUbHTF1bYOTtg0wwTL-hxHAM1_BrcSQipWMbyZEQYToqlVXwSs9L25CeWutPyJO3Y6XMsEagSXWCHf2Q46YmNHhlod2P21PMXdShae-Flv0DHapas8MLOazvGeN_h1c5ApWPUY2DHPrBCPWLoGa3TZz0Kg35u7RT0IMwiRYwKP44x_smMwnj7Mz7mYvtr3la9_Owj0HL9xgEHxufRvqBeeaEUI66C3YChFwF1ACo9ivFGQL-tlqOdJuvCPOpwBTosreOzj2-wkaoztct2IuI6LZMkKbKioqivZUmy6PIylV2S5ynl2y5Ly7Zts-Xttoh0TQllaZoWaZZsieKyEhlXRSKV2HadKCBPeBDafM1bpL2fuS4pK6vIiJaNX4NMtHRAtv_M2gMR0AGIhjWOm8_FpVYcI1cvg5t2PnvIE6N98B_Lgg5m_VEOfz1AccT3VH_jTGcd-kG8AlVLYBDoDkugHQI1WC1mpcvppWfHKNBD9gsm0exM_d2X1KGf21jaAahZxdwem8nZ_1gGoGbV7oGaVf7_AQAA__8nyTh0">