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

    <tr>
        <th>Summary</th>
        <td>
            [IPRA][X86] push/pop rbp is unexpectedly optimized out in the function.
        </td>
    </tr>

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

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

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

<pre>
    When enabling IPRA on X86 on spec-2017/503_bwaves, a segfault happened immediately. I tried to lower the issue. It turns out IPRA is not working correctly on below example: https://gcc.godbolt.org/z/6hh88xv9r. Normally, when a certain callee saved register in caller is not live across the the call, callee's `push/pop CSR` can be optimized out when IPRA is on. (e.g. if I changed the callee to clobber another callee saved register r12, its push/pop can be optimized out: https://gcc.godbolt.org/z/9nbTMe856) While the issue here we can tell from generated codes that rbp is live across `call foo`, but it's neither saved/reload in caller or callee, which is explicitly a correctness issue.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMk0uL3DoQhX-NvCnG2PJ74cU8MDTce7lMAjO7oEe1rUSWjCT3Y359kKc70wkJZGFqYbvqO6dOMe_VaBB7Uj2Q6ilha5is6weHUp7_QbZPuJXn_mVCA2gY18qMsPv_-R6sgde2jsUvKO5oljeEDlVWfOFHdkBP6CMw8Dju2aoDTGxZ0KAENc8oFQuozynsIDiFEoIFbY_oIEwIyvsVU9gFCKszHuwa3kcqD8YGOFr3LWII6xyKoM8RgqO2R8ATmxeNpLiHKYTFk-Ke0IHQYRQiHa3kVofUupHQ4Y3QoZ6mtj0dOpfCf9bNTOtzxD5GtQwEusCUAcG0RgTPDijB4ah8QAfXF-6KpdUBgQlnvd9kxCd-ETu-tyC08UDqbFn9ROiw2AUePz2TOgPBogKwS1CzekO5ad4wrsKtSYHQFtMxBbWHHYiJmTFadxmDGF0U2nKODpixYUL3B3aX00ilgocblt9B_K2TneGf_8W2qgnt4GVSGj9WCRM6hCNuAwJqDXtnZxjRoGMBJQgrMXrGAji-RLW3XpI6iypgby2ps8jN1wAqbG4aVJvOTSChg0NtmbxZjnU_zI-LVWKK_fG0aCVUzA675sig95fsJbIvZFd0LME-b2iTl1nXFcnUV6KgnJdVLvKGZQ3PK5lhV6IoSykLJhPV04yWWUfLLKdFXqS8qZCJtq3yvKCsrUiZ4cyUTrU-zNHAZBvZ51nXFF2iGUftt2uk1ODxHYhQGo_T9fGnO76OnpSZVj74jzZBBb2dcUwMqZ5I9fDa1qR6ul3xxd7V4GlBEVDG4_kpdMpsi9uvRgRlTZqsTve_JECFaeWpsDOhQ5x_KXeLs19RBEKHjdoTOlxkHXr6PQAA__8gUXo6">