Skip to content

Commit 2ecca53

Browse files
committed
Update HLSLAttributedResourceType evaluation kind to TEK_Scalar (was TEK_Aggregate)
TEK_Aggregate is not a good fit for the resource type.
1 parent c163d06 commit 2ecca53

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ TypeEvaluationKind CodeGenFunction::getEvaluationKind(QualType type) {
282282
case Type::ObjCObjectPointer:
283283
case Type::Pipe:
284284
case Type::BitInt:
285+
case Type::HLSLAttributedResource:
285286
return TEK_Scalar;
286287

287288
// Complexes.
@@ -296,7 +297,6 @@ TypeEvaluationKind CodeGenFunction::getEvaluationKind(QualType type) {
296297
case Type::ObjCObject:
297298
case Type::ObjCInterface:
298299
case Type::ArrayParameter:
299-
case Type::HLSLAttributedResource:
300300
return TEK_Aggregate;
301301

302302
// We operate on atomic values according to their underlying type.

clang/test/CodeGenHLSL/builtins/hlsl_resource_t.hlsl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ using handle_float_t = __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::c
55
// CHECK: %"class.hlsl::RWBuffer" = type { target("dx.TypedBuffer", <4 x float>, 1, 0, 0)
66
// CHECK: %"class.hlsl::StructuredBuffer" = type { target("dx.RawBuffer", %struct.MyStruct = type { <4 x float>, <2 x i32>, [8 x i8] }, 1, 0)
77

8-
// CHECK: define void @"?fa@@YAXU__hlsl_resource_t@@uA@A@M@Z"(ptr noundef byval(target("dx.TypedBuffer", float, 1, 0, 0)) align 4 %a)
9-
// CHECK: call void @"?foo1@@YAXU__hlsl_resource_t@@uA@A@M@Z"(ptr noundef byval(target("dx.TypedBuffer", float, 1, 0, 0)) align 4 %a)
10-
// CHECK: declare void @"?foo1@@YAXU__hlsl_resource_t@@uA@A@M@Z"(ptr noundef byval(target("dx.TypedBuffer", float, 1, 0, 0)) align 4)
8+
// CHECK: define void @"?fa@@YAXU__hlsl_resource_t@@uA@A@M@Z"(target("dx.TypedBuffer", float, 1, 0, 0) %a)
9+
// CHECK: call void @"?foo1@@YAXU__hlsl_resource_t@@uA@A@M@Z"(target("dx.TypedBuffer", float, 1, 0, 0)
10+
// CHECK: declare void @"?foo1@@YAXU__hlsl_resource_t@@uA@A@M@Z"(target("dx.TypedBuffer", float, 1, 0, 0))
1111

1212
void foo1(handle_float_t res);
1313

1414
void fa(handle_float_t a) {
1515
foo1(a);
1616
}
1717

18-
// CHECK: define void @"?fb@@YAXU__hlsl_resource_t@@uA@A@M@Z"(ptr noundef byval(target("dx.TypedBuffer", float, 1, 0, 0)) align 4 %a)
18+
// CHECK: define void @"?fb@@YAXU__hlsl_resource_t@@uA@A@M@Z"(target("dx.TypedBuffer", float, 1, 0, 0) %a)
1919
void fb(handle_float_t a) {
2020
handle_float_t b = a;
2121
}

0 commit comments

Comments
 (0)