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

    <tr>
        <th>Summary</th>
        <td>
            [HLSL] Very slow compilation time if a large array is used in a semantic
        </td>
    </tr>

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

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

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

<pre>
    When a large array is declared as input, seems like Clang is taking very long to compile.
This seems to be an issue with SROA generating a huge function, which then takes ages to go through InstCombine.

This is for now not actionable as-is since we can only load compute shader semantics with vector types as of today.
Reaching this bug requires user semantics to be implemented. But keeping track of this for later.


```hlsl
// RUN: %clang --driver-mode=dxc %s -T cs_6_8 -E main -O3

struct S1 {
  float4 elt[10000] : F;
};

RWBuffer<float4> output : register(u0);

[numthreads(1, 1, 1)]
void main(S1 p : X) {
  output[0] = p.elt[1];
}
```


</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxkVF-PozYQ_zTmZZQIbMifBx6SzUWteupJu9de304DDOCusak9TrrfvjJht61OsgAL__6MPT9jCHqwRLWozqK6ZBh5dL7-hchGDlnjurf620gWEAz6gQC9xzfQATpqDXrqAANoO0cW8gkC0RTA6FeCJ4N2SAsZX7Ud4Eb-DYyzA7CD1k2zNrQV-enrqMOKYwcNAVrQIUSCu-YRXp6_nGAgSx450SCMcSDoo21ZO5tE76NuR-DkkvGVAuBAC9nggEfv4jDCzzbwk5sabRfRd10doHcerLuDdQy4cGJjCDBski9tW4I7QYsWnDWpAuwW-5EJwogdeQg0oWXdhoflG7XsPPDbnLwEcD2w6_AtCT8TtmOqg5N8Ewfw9FfUngLE8D-qx2boaTY0kWXqtnCODK9E84L32L4u1ONahEEmvxaXxi5_jNEEk-byKuQVnn_7VagTCFm1ywFtNp3XN_KbyXUk1KX7u00_A2y-Qhu-774fYPMJJtQWNl_Ugzqwjy3DSwFifxb5CaA3DrkEMiyqc5HneS6qCyShq1Bpidhf1o_89PztHPuevFBPD5xQn8BFniMvEE-DDkxeyEPMhTx-AEV1tnHi0RN2QchDkU7__XEU1UXkp5vT3WJXyMNLAfPC-IeQxw-vDyVRnVePF5i3q_FE8WH3P1v4kM-6WnVHdcSM6mJfleVhXxwP2VirSnbdnqpdT3muqmO56xtUqMoD7dSxbDNdy1xW-SHfFUqp4rDtdqqgssQKlWr6XSPKnCbUZmvMbdo6P2RLBOqikirfZwYbMmHJqJSW7o-ACCmFfBJS_vT55XOaVJfM14lh08QhiDI3OnD4l5M1myXpC6C6wO8pk8G4-xpITO0PrCcC3f8Y-RioA53ugvc2zaI39cg8B6HWDhs0j7HZtm4S8pqk19dm9u5PalnI6-I-CHldy7vV8p8AAAD__795bz8">