Issue 152815
Summary [HLSL][DirectX] Invalid DXIL when partially assigning to RWStructuredBuffer vector
Labels new issue
Assignees
Reporter kmpeng
    https://godbolt.org/z/KPf9YW736
```hlsl
RWStructuredBuffer<uint4> Out : register(u1);

[numthreads(1,1,1)]
void main() {
  Out[0].xy = uint2(1, 2);  // Only assign first two components
}
```
This code, when compiled, produces invalid DXIL:
```
# .---command stdout------------
# | Function: main: error: Instructions must be of an allowed type.
# | note: at '%.upto23 = insertelement <4 x i32> <i32 1, i32 2, i32 undef, i32 undef>, i32 %3, i32 2' in block 'entry' of function 'main'.
# | Function: main: error: Instructions must be of an allowed type.
# | note: at '%4 = insertelement <4 x i32> %.upto23, i32 %2, i32 3' in block 'entry' of function 'main'.
# | Function: main: error: Instructions must be of an allowed type.
# | note: at '%5 = extractelement <4 x i32> %4, i32 0' in block 'entry' of function 'main'.
# | Function: main: error: Instructions must be of an allowed type.
# | note: at '%6 = extractelement <4 x i32> %4, i32 1' in block 'entry' of function 'main'.
# | Validation failed.
# |
# `-----------------------------
# .---command stderr------------
# | clang-dxc: error: dxv command failed with exit code 1 (use -v to see invocation)
# `-----------------------------
# error: command failed with exit status: 1
```

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to