================
@@ -1,9 +1,53 @@
-// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm 
-O1 -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library 
-finclude-default-header -x hlsl -emit-llvm -o - %s | FileCheck %s
 
-void foo(__hlsl_resource_t res);
+using handle_float_t = __hlsl_resource_t [[hlsl::resource_class(UAV)]] 
[[hlsl::contained_type(float)]];
 
-// CHECK: define void 
@"?bar@@YAXU__hlsl_resource_t@@@Z"(target("dx.TypedBuffer", <4 x float>, 1, 0, 
0) %[[PARAM:[a-zA-Z0-9]+]])
-// CHECK: call void 
@"?foo@@YAXU__hlsl_resource_t@@@Z"(target("dx.TypedBuffer", <4 x float>, 1, 0, 
0) %[[PARAM]])
-void bar(__hlsl_resource_t a) {
-    foo(a);
+// CHECK: %"class.hlsl::RWBuffer" = type { target("dx.TypedBuffer", <4 x 
float>, 1, 0, 0)
+// CHECK: %"class.hlsl::StructuredBuffer" = type { target("dx.RawBuffer", 
%struct.MyStruct = type { <4 x float>, <2 x i32>, [8 x i8] }, 1, 0)
+
+// CHECK: define void 
@"?fa@@YAXUHLSLAttributedResourceType@__hlsl@@@Z"(target("dx.TypedBuffer", 
float, 1, 0, 0) %a)
+// CHECK: call void 
@"?foo1@@YAXUHLSLAttributedResourceType@__hlsl@@@Z"(target("dx.TypedBuffer", 
float, 1, 0, 0) %0)
+// CHECK: declare void 
@"?foo1@@YAXUHLSLAttributedResourceType@__hlsl@@@Z"(target("dx.TypedBuffer", 
float, 1, 0, 0))
+
+void foo1(handle_float_t res);
+
+void fa(handle_float_t a) {
+    foo1(a);
+}
+
+// CHECK: define void 
@"?fb@@YAXUHLSLAttributedResourceType@__hlsl@@@Z"(target("dx.TypedBuffer", 
float, 1, 0, 0) %a)
+void fb(handle_float_t a) {
+    handle_float_t b = a;
 }
+
+// CHECK: define void 
@"?fc@@YAXV?$RWBuffer@T?$__vector@M$03@__clang@@@hlsl@@@Z"(ptr noundef 
byval(%"class.hlsl::RWBuffer") align 16 %a)
+// CHECK: call void 
@"?foo2@@YAXV?$RWBuffer@T?$__vector@M$03@__clang@@@hlsl@@@Z"(ptr noundef 
byval(%"class.hlsl::RWBuffer") align 16 %agg.tmp)  
+// CHECK: declare void 
@"?foo2@@YAXV?$RWBuffer@T?$__vector@M$03@__clang@@@hlsl@@@Z"(ptr noundef 
byval(%"class.hlsl::RWBuffer") align 16)
+void foo2(RWBuffer<float4> buf);
+
+void fc(RWBuffer<float4> a) {
+  foo2(a);
+}
+
+void fd(RWBuffer<float4> a) {
+  RWBuffer<float4> b = a;
+}
+
+struct MyStruct {
+  float4 f;
+  int2 i;
+};
+
+// CHECK: define void @"?fe@@YAXV?$StructuredBuffer@UMyStruct@@@hlsl@@@Z"(ptr 
noundef byval(%"class.hlsl::StructuredBuffer") align 16 %a)
+// CHECK: call void @"?foo3@@YAXV?$StructuredBuffer@UMyStruct@@@hlsl@@@Z"(ptr 
noundef byval(%"class.hlsl::StructuredBuffer") align 16 %agg.tmp)
+// CHECK: declare void 
@"?foo3@@YAXV?$StructuredBuffer@UMyStruct@@@hlsl@@@Z"(ptr noundef 
byval(%"class.hlsl::StructuredBuffer") align 16)
----------------
pow2clk wrote:

I'm afraid this change #111632 will cause these mangles to change and this test 
to fail. Just a note in case the order of things results in that change going 
in between when this one is last tested and when it's submitted.

https://github.com/llvm/llvm-project/pull/110327
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to