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

    <tr>
        <th>Summary</th>
        <td>
            Optimizations targeting AVX512 may cause never-ending compilation
        </td>
    </tr>

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

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

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

<pre>
    Hi,
I have ran into a problem when trying to target rocketlake microarchitecture (AVX512 capable), when optimizations are enabled (any level: 1, 2, or 3). The compiler does not crash, miscompile or otherwise err, but rather it is unable to finish its work. What should be a couple seconds job, at most, may take many minutes, at which point I just assume that the compilation will never finish.

The source file that fails to be compiled does not contain any AVX512 code, but it has a considerable amount of AVX2 code. It is interesting that the rest of source files in the project can be compiled properly, even if there may be some AVX2 code in them.

**How to reproduce:**

1. Clone https://github.com/wolfpld/etcpak.git and checkout 14dfc2b8d.
2. Execute `clang++ -c -O0 -march=rocketlake -std=c++11 ProcessRGB.cpp`. Notice the compilation with optimization disabled succeeds in a timely manner.
3. Execute `clang++ -c -O1 -march=skylake -std=c++11 ProcessRGB.cpp`. Notice the compilation targeting skylake uarch (AVX2) succeeds promptly.
4. Execute `clang++ -c -O1 -march=rocketlake -std=c++11 ProcessRGB.cpp`. Observe that the clang process will enter what seems to be an infinite loop, slowly consuming more and more memory.

**Affected versions:**

I have checked that the issue is present at least in clang 13.0.1 and 14.0.1.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVE2P4zYM_TXOhYjhr-wmBx9md7rduXSKouj2Kkt0rIksGZI8afrrS8rOTAYYLLpYwHAckSIfH8nXOXVpv-qs-pwV91lx9wCDeEbwwoK20YGAybvO4AjnAS1Ef9H2CGSIwh8xgnfyhNGIE8KopXfCy0FHlHH2CFm1v_vr711ZgRSToChZdaBMSyg3RT3qf0XUzgYQ5I6Wf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