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

    <tr>
        <th>Summary</th>
        <td>
            [DirectX] Arrays of vectors remain in alloca and global variables after scalarization
        </td>
    </tr>

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

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

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

<pre>
    There are alloca and global variables of arrays of vectors that remain after data scalarization, array flattening, and scalarization passes when compiling several DML shaders. 

These allocas and global variables appear to be used by `memcpy` intrinsics.

Example:
```c++
@outputStrides = external addrspace(2) global [2 x <4 x i32>], align 16
...
define void @CSMain() local_unnamed_addr #2 {
  %1 = alloca [2 x <4 x i32>], align 16
  ...
 call void @llvm.memcpy.p0.p2.i32(ptr noundef nonnull align 16 dereferenceable(32) %1, ptr addrspace(2) noundef align 16 dereferenceable(32) @outputStrides, i32 32, i1 false)
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMU82O3DYTfJrWpWGBaknzc9BhdscDfMDnk33IzWiRrREDDimQ1Hg3Tx9Qs-vEcZAEoKAfqquK1V2ckr16kQH6J-jPFa95DnH4nw6zmBh8NQbzOnyZJQpyuZwLmpG9wasLIzu8c7Q8OkkYJuQY-XV7uovOISbMM2eMcmPrkacsEQ1nxqTZcbS_cbbBAz0_KnFynLN466_bN29-_BEXTkkSfpvFow63xTrrr5jkLpEdnj_9H9PMRmKqEdQJ1OnLLOlddfp72bwswhFzwFFwTWJwfEXYqZvc9PIKO4XW52h9sjrVD9SPL3xbnEBbXmCnHksDPZWlTtCpsOZlzZ9ztEYSQntGeckSPTtkY2JaWAvQgYCO75KgfyJ8QWifO3xB2xK0H6E_b044e_XY7ECd6rqIMDJZL3gP1iB06vnzJ7Ye6FDgylnd19V7von5WtgQqCWEfdGGCNQ3m6K3Zv43XsQHM2p27juxc_db_XCqXlS9UF3q6bDkiD6s3siEPni_OvcdDI1EmSSK11JaAHRoNx-KsMJain8y6R3t31H-Yn5BtC1h2X1G2-DELgnQ8c-9q8zQmmN75EqGZt_t265XXV_NAxkSPY6T7qd-7FQvPE0H1VEj-07rY1PZgRT1qm96ato99fXuYLTu1dRoGUceBTpVxt_Vm1chXiub0ipD06mmayvHo7i05Y_IyzfcdoGoxDEOpejDuF5TMdumnP6AyTa7LbhnG0XnX6A_4-mnAL5lr8TvH7L7iOYPYavW6IY55yWVOacL0OVq87yOtQ43oEvR8Xb7sMTwq-gMdNnUJ6DL2_HuA_0eAAD__2bNZ_o">