Issue 114131
Summary Invalid type description generated in DXIL IR for StructuredBuffer
Labels bug, HLSL
Assignees
Reporter coopp
    An invalid form of a type was being generated in the DXIL IR for the StructuredBuffer type.  This form was causing 'opt' to fail with a syntax error while parsing the IR.

godbolt: https://godbolt.org/z/zf7TTWa5q

Shader compiled with -T cs_6_6
```
struct mystruct
{
    float4 Color;
};

StructuredBuffer<mystruct> my_buffer : register(t2, space4);

export float4 test()
{
    return my_buffer[0].Color;
}

[numthreads(1,1,1)]
void main() {}
```

See `%"class.hlsl::StructuredBuffer" = type { target("dx.RawBuffer", %struct.mystruct = type { <4 x float> }, 0, 0), %struct.mystruct }`

Type section for IR
```
%"class.hlsl::StructuredBuffer" = type { target("dx.RawBuffer", %struct.mystruct = type { <4 x float> }, 0, 0), %struct.mystruct }
%struct.mystruct = type { <4 x float> }
%dx.types.Handle = type { ptr }
%dx.types.ResBind = type { i32, i32, i32, i8 }
%dx.types.ResourceProperties = type { i32, i32 }
```

The part "%struct.mystruct = type" is causing the parsing error.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to