================
@@ -0,0 +1,85 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -emit-llvm 
-disable-llvm-passes -finclude-default-header -o - %s | llvm-cxxfilt | 
FileCheck %s
+
+struct MyStruct {
+  float f;
+  RWBuffer<float> Buf;
+
+  void Store() const {
+    Buf[0] = f;
+  }
+};
+
+// CHECK-DAG: %"class.hlsl::RWBuffer" = type { target("dx.TypedBuffer", float, 
1, 0, 0) }
+// CHECK-DAG: %__cblayout_CB = type <{ %__cblayout_MyStruct }>
+// CHECK-DAG: %__cblayout_MyStruct = type <{ float }>
+// CHECK-DAG: %struct.MyStruct = type { float, %"class.hlsl::RWBuffer" }
+cbuffer CB {
+  MyStruct one;
+}
+
+// CHECK-DAG: @one.Buf = internal global %"class.hlsl::RWBuffer" poison, align 
4
+// CHECK-DAG: @CB.cb = internal global target("dx.CBuffer", %__cblayout_CB) 
poison
+// CHECK-DAG: @one = external hidden addrspace(2) global %__cblayout_MyStruct, 
align 4
+
+// $Globals constant buffer
+// CHECK-DAG: @"$Globals.cb" = internal global target("dx.CBuffer", 
%"__cblayout_$Globals") poison
+// CHECK-DAG: %"__cblayout_$Globals" = type <{ %__cblayout_MyStruct }>
+// CHECK-DAG: @two.Buf = internal global %"class.hlsl::RWBuffer" poison, align 
4
+// CHECK-DAG: @two = external hidden addrspace(2) global %struct.MyStruct, 
align 4
+MyStruct two;
+
+// CHECK-DAG: @Constants = internal global %"class.hlsl::ConstantBuffer" 
poison, align 4
+// CHECK-DAG: %MyConstants = type <{ <4 x float>, <3 x i32> }>
+// CHECK-DAG: %struct.MyConstants = type { <4 x float>, <3 x i32> }
+
+struct MyConstants {
+  float4 vec;
+  int3 pos;
+  int3 getPosition() const { return pos; }
+};
+
+ConstantBuffer<MyConstants> Constants;
+
+// CHECK-LABEL: main
----------------
hekota wrote:

Thanks for letting me know! Here is a fix: 
https://github.com/llvm/llvm-project/pull/207232

https://github.com/llvm/llvm-project/pull/206596
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to