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

    <tr>
        <th>Summary</th>
        <td>
            [DirectX] `inout` on arrays of vectors is not correctly handled
        </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>
    After fixing #147114 there are now 14 DML shaders failing to pass validation due to error `Instructions should not read uninitialized value`. 
While this validation error was encountered and fixed before (#139011), this appears to another unique case.

Reproduction: https://godbolt.org/z/vd1jWr79P

The following shader defines and uses a function `FillZero` with an inout parameter to fill an array of vectors with zeros.
Calling `FillZero` with `foo` does not correctly set `foo` to zeros.
```hlsl
// compile args: -T cs_6_7 -E CSMain
void FillZero(inout uint32_t2 v[2]) {
  v = { uint32_t2(0, 0), uint32_t2(0, 0) };
}
RWStructuredBuffer<uint32_t> output;
cbuffer Constants { uint32_t2 bar[2]; }
[numthreads(1, 1, 1)] void CSMain() {
  uint32_t2 foo[2];
 FillZero(foo);
  output[0] = dot(foo[0], bar[0]);
}
```

The resulting IR contains a `mul` instruction with one operand being `undef`, which is not valid and causes a validation error
```llvm
Function: CSMain: error: Instructions should not read uninitialized value.
note: at '%2 = mul i32 undef, %.extract' in block 'entry' of function 'CSMain'.
Validation failed.
```

One DML shader with this issue is `Cast_float16_native_accum32_uint8_packed32_256_Strided8D.dat`
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVcuu2zYQ_ZrxZnANirIka-GFHzEQoEGLJGiKbgxaHF0xoUmXDzs3X1-M5Bs7aTYFDEt8zOGZM4cjFaN5dkQrqDZQ7WYqp8GH1dvOD6SDd7Oj1y-rdZ8oYG--GveMIMti0RTFAtNAgVAFQuevWCxw9-43jIPSFCL2yljenjyeVYx4UdZolYx3qDPxNIXgA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