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

    <tr>
        <th>Summary</th>
        <td>
            [X86KCFI] llvm_unreachable("Unexpected CFI call opcode") is reached
        </td>
    </tr>

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

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

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

<pre>
    When compiling a file with `-O2 -fsanitize=kcfi`, a debug build of clang crashes from hitting `llvm_unreachable("Unexpected CFI call opcode")` in `llvm/lib/Target/X86/X86KCFI.cpp`.  Crash backtrace, preprocessed source, and associated run script for a minimal reproducer are attached.

[backtrace.txt](https://github.com/llvm/llvm-project/files/10018542/backtrace.txt)
[repro-bf6755.c.txt](https://github.com/llvm/llvm-project/files/10018493/repro-bf6755.c.txt)
[repro-bf6755.sh.txt](https://github.com/llvm/llvm-project/files/10018502/repro-bf6755.sh.txt)

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytU0uP1DAM_jXtxZqqTaed9tDDMqOREAcuILghJ3HasOlDScou_Hrc7iwIBAfQSpWTOvH3cF0566_dh4EmUPO4WGenHhCMdQQPNg6Q1PnhrYCDCTjZaL9RUl7ulbGcT8SZr2qSaw9ytU7DbEA5ZATlMQwUwPh5hMHGuMFyiXNfxk_r5AnVgNJRIppEiPcTPS6kImk4X1-DQudgXtSs-VwkouVCsNNzfSKuzkqO79D3FHnzsamf4hsuz9Sy8M0M4LyJAInqPnpUtMldPC1-VhQCc4V59U9pnDRgCLOyuInw6wRBebtEMLNnj6Od7IgO9mq9KuKkJ8AY2QfpLMkvSX53i9WrH5RZfIxJdWGXQ4xLSMo71slPz51dZcYd38zcPPFyYPjP3Ah-3b5A4LXI86KpjtyG66-w3JZnvl3WQZr6VFWZeinSY1vy9g_Yf2MOw4v5zcXv1DfwZ-6UuqKum-rUVGWZ6q7UbdliGm101LGw2zCwGPi_mQMbYC8hna7edf9syIaw7o6qNi9O6dA1UtamQtStoaYp0RiNBYljofDUlCeROpTkwqaeJUz0ADvEJqe6pLYTuRBFUdR5nYuizJQqWtNiTVRWppZlcsxpROuyTUc2-z713S6Jf8_Ah86GGH4e8rjbfqK9WRs-rnGYfUfS9j35kO7c3a79O3U6USQ">