Issue 149345
Summary [HLSL][DirectX]
Labels new issue
Assignees
Reporter spall
    https://godbolt.org/z/To9e81PWs

```
StructuredBuffer<uint4> In : register(t0);
RWStructuredBuffer<uint4> Out : register(u1);

[numthreads(1,1,1)]
void main() {
  Out[3] = AddUint64(In[0], In[0]);
}
```

This code, when compiled, produces invalid DXIL

```
# .---command stdout------------
# | Function: main: error: Instructions must be of an allowed type.
# | note: at '%.upto077112 = insertelement <2 x i1> undef, i1 %.elem1, i32 0' in block 'entry' of function 'main'.
# | Function: main: error: Instructions must be of an allowed type.
# | note: at '%58 = insertelement <2 x i1> %.upto077112, i1 %.elem17, i32 1' in block 'entry' of function 'main'.
# | Function: main: error: Instructions must be of an allowed type.
# | note: at '%.i09113 = extractelement <2 x i1> %58, i32 0' in block 'entry' of function 'main'.
# | Function: main: error: Instructions must be of an allowed type.
# | note: at '%.i110114 = extractelement <2 x i1> %58, 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
```

These 'insertelement' and 'extractelement' instructions are created by the scalarizer pass, but are unnecessary and could be eliminated.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to