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

    <tr>
        <th>Summary</th>
        <td>
            [DirectX] Validation errors: `Pointer type bitcast must be have same size` and `Bitcast on struct types is not allowed`
        </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>
    ## The Problem
After resolving #146974, validation errors of the form `Pointer type bitcast must be have same size` and `Bitcast on struct types is not allowed` appear.
There are 16 occurrences of both errors in total, and they all originate from two DML shaders: `OneHot_256_uint16_native_int64_emulated_4` and `OneHot_256_uint16_native_int32_native_4`

## Reproducing the problem
Validate one of the problematic DML shaders mentioned.
```
dxv validation/OneHot_256_uint16_native_int32_native_4.dat
``` 

This minimal shader also reproduces the validation error when validated after being compiled
```hlsl
// compile args: -E CSMain -T cs_6_2 -enable-16bit-types 
RWStructuredBuffer<uint> output;
struct MyStruct {
  uint arr[2];
};
[numthreads(1, 1, 1)]
void CSMain(uint3 Tid: SV_DispatchThreadID) {
  MyStruct s = {Tid.x, 0};
  uint d = s.arr[Tid.y];
  output[0] = d ;
}
```
https://godbolt.org/z/GexqvYc1d




</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0VE9v47YT_TTUZWCDoiwpOuhgx-vfb4EGXWyMtD0ZlDiyWFCkSo6cZD99QVlO3RyKXgoQ_kO-mXnz5mFkCPpsEWuW71i-T-REvfP119b1qLyzSePUe81ExkQGxx7hm3eNwYHx7bYj9OAxOHPR9gxMZOmmqMoNE49wkUYrSdpZQO-dD-A6oB6hc34AVvBvTtsYT-8jQqOplYFgmAJBg9DLC0KQA0LQP5AVHKRVMWq3AJ2FQH5qaY4PoANYRyCNca-o5oBxROnXjG-PPXoE6RHSAlzbTt6jbXFm1Djqb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