<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=http://email.email.llvm.org/c/eJylVNuO2zYQ_RrpZbACRUn26kEPTrZbBEhSIN4fGJEjiQlNGiRlZ_P1HdrOZhugQYoChHjRcOacw0OOXj8PTwuB9mcXUyA8gIlxJf7CktIxFs2ukI_cxnWOVTybKVU-zHkh-HMkHuw_3dVd19SFeCjE7vp96100mgIkTo4poVpIw2iS8poq-LQ6Z9wMxUZYq4CjHalkvNsnTPSBo42j79Xg7i_BgYBT4oRa4LRt5KiFUKLpxTQqtZl6Iegeu57Gpu_aWmwUjOvhGC_1lT8cjcWcH5I5EEzBH6CDSMo7zTEeevF9VkHW44CffTDpGfx03cJ6xCO5BMbBe5rRmm8UKthpnXn8U6pAJ0PnWFl7OtzEeqhFX3ctBNKron-BlQ8hgym2f8gXdIV8y1QSxGSsBYRlnTnSTBMFcoqq16rvIkwYACO8A4WOU1DenhZGzw154cTbbpXpWjXQHCjGjGLyAfZZdOiqDk6Ruw3LPuWzYZZUzdVPVGeTlnWsOCFPTnj0gfujjynnvHPG8_RiKObxKEUH6DREz2U9SxBe--4Y_GcuFIGBIAa1bNrX3J5wni-WacXTRx_S4plKnvngMCG8ji26N7-2VPXNHIvuoZD3v6CTj-_W3d3A8XRi4TKZ7X1z39YNj36jlOxLPTS6b3oscWXsYcBoyzXY4T8DeJGTr5zoy2XY6K0ehW7rsR9b3TZqnLpablVXNxK1rEuLI9k4sCqFlCOqL-Q0V9ztriJLmU3C3Wz9yMaOZPNa91D-f3RmkEJKUdfc6m1bVxPitsMGtdZdXW-ID5AOaOzLZSnDcEmZ3xv-yXDSj5tUIht1dkQXMowwmWRp2F9t_bOd-ar-eaH0bk-WCT7-uLlwZio3r9NXNmx-nZ5_-3EpLzSHC8e_AZACu0Y>53109</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Severe time regression in GlobalISel / Legalizer with Swift exposed by d0af732bd00c0390fbcc6f900e8a59eb3954106c
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:AArch64,
            globalisel
      </td>
    </tr>

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

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

<pre>
    The downstream issue is https://bugs.swift.org/browse/SR-15531

Consider the attached bitcode. Running `llc ConnectionStateMachine.swift.o -O0` after d0af732bd00c0390fbcc6f900e8a59eb3954106c bumps the compilation time from 5 seconds to 90 seconds. The majority of time is spent in Legalizer. Adding https://reviews.llvm.org/D109154 reduces the compilation time down to ~25 seconds, but still a huge difference.

As far as I can see, this is a severe compile time regression for Swift 5.5 vs 5.6 affecting e.g. https://github.com/vapor/postgres-nio/issues/205 and some other downstream projects on aarch64

Tagging @TNorthover @ornata 

[ConnectionStateMachine.swift.o.zip](https://github.com/llvm/llvm-project/files/7838413/ConnectionStateMachine.swift.o.zip)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVNtu2zAM_Rr7hagh23ESP_ghW7dhwC5A0x-gLcrWpkiBJCdrv35UkrVZgRUdIFimTJE855DunXzo7icC6Y42RE-4Ax3CTPyEKcZ9yOpNVn3k1c9jKMJRq1g4P6YD746B-GV7d1M2TV1m4jYTm_PzvbNBS_IQOTjGiMNEEnodByepgLvZWm1HyJbCmAHY29IQtbPbiJG-sre29Ccb3HwX7AioIgeUAtWqrnopxCDqVqh-GJaqFYLW2LTU122zKMVygH7e7cMp_-B2e20wxYeodwTKux00EGhwVrKPg1b8sQpIfOzwh_M6PoBT5yvMR9iTjaAtfKERjX4kX8BGyoTjb6o8HTQdQ2HMYXch67YUbdkswJOcB_pHWUmEVEy2-lA9VZdV7xlKhBC1MYAwzSN7aqXIkx2ouGZ9E0ChBwzwGQa0HILS9Thx9byQDw587ZKZzlk9jZ5CSFUo52GbSIemaOAQeFsy7SppwyipGIsXUEcdp7kvOCAbB9w7z_vehZhi3ljt2Dw1FOP4WIkG0EoIjtM6psBf993eux-cKAAXguiHabm4xnaP43hqmYW4_-Z8nBxDSZbzFiPCtW_WvHu9pYpHvc-a26xavwInyXfZbi7FsamYuARmta7Xi7LmtzekqtpcdrVs6xbzqKOhbntW4qUC3F2fjOvRfN6SAQ7-3Gxw5OIu8tAv5jgN1MOb5yGfven-G-2Tdjzfos2njhpatxWVtVK9aqpa9Yu1atWqFyuxXK0pN9iTCR1LkFVVj8NPspIzbjZnRasqdSRv4wmmDmTSWXOb664SVSXKkle5WpSFQlw1WKOUsinLJbHWtENtnuYq992p3PRr4o8cLD4PXY7M6GiJTqVwfJy5Z3yHweQnVN0J0m9QYqYF">