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

    <tr>
        <th>Summary</th>
        <td>
            [CodeGen] Machine Late Instructions Cleanup Pass spends significant time at clearKillsForDef.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:AMDGPU,
            slow-compile
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            vpykhtin,
            JonPsson
      </td>
    </tr>

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

<pre>
    The attached testcase for AMDGPU target shows significant time spent in the _Machine Late Instructions Cleanup Pass_. Vtune profiler shows _clearKillsForDef_ function as the main reason.

\> llc -mtriple=amdgcn-hsa-amdhsa -mcpu=gfx90a -time-passes -no-stack-slot-sharing long-compile-time-func.bc

```
Total Execution Time: 670.4078 seconds (670.7149 wall clock)

---User Time---   --System Time-- --User+System--   ---Wall Time---  --- Name ---
289.2998 ( 43.7%)   0.1439 (  1.8%)  289.4437 ( 43.2%)  289.5775 ( 43.2%)  Structurize control flow
124.9852 ( 18.9%)   0.0000 (  0.0%)  124.9852 ( 18.6%)  125.0289 ( 18.6%)  Machine Late Instructions Cleanup Pass
 45.2408 (  6.8%)   0.0000 (  0.0%)  45.2408  (  6.7%)  45.2740  (  6.8%)  SI Form memory clauses
 38.0358 (  5.7%)   0.0240 (  0.3%)  38.0598  (  5.7%)  38.0767  (  5.7%) Simple Register Coalescing
...
```
[long-compile-time-func.zip](https://github.com/llvm/llvm-project/files/10965409/long-compile-time-func.zip)

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVF1v2zYU_TX0ywUJipQs6cEPaVwX3dYhWNLtMaCpK4kLRQok1TT99YNkK3GbBugAQ7bP_TjnipdHxWg6h7gjxTsixJfx6aFPxhEhiLgmQvzm3U2MfgGK_UZNqfdht6Ztjr552t31CColpXtsIGFMWkWE1ge4-rT_c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