Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions llvm/include/llvm/Analysis/DXILResource.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,25 @@ class LayoutExtType : public TargetExtType {
}
};

/// The dx.Padding target extension type
///
/// `target("dx.Padding", NumBytes)`
class PaddingExtType : public TargetExtType {
public:
PaddingExtType() = delete;
PaddingExtType(const PaddingExtType &) = delete;
PaddingExtType &operator=(const PaddingExtType &) = delete;

unsigned getNumBytes() const { return getIntParameter(0); }

static bool classof(const TargetExtType *T) {
return T->getName() == "dx.Padding";
}
static bool classof(const Type *T) {
return isa<TargetExtType>(T) && classof(cast<TargetExtType>(T));
}
};

//===----------------------------------------------------------------------===//

class ResourceTypeInfo {
Expand Down
47 changes: 43 additions & 4 deletions llvm/lib/Analysis/DXILResource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,38 @@ static StructType *getOrCreateElementStruct(Type *ElemType, StringRef Name) {
return StructType::create(ElemType, Name);
}

static Type *getTypeWithoutPadding(Type *Ty) {
// Recursively remove padding from structures.
if (auto *ST = dyn_cast<StructType>(Ty)) {
LLVMContext &Ctx = Ty->getContext();
SmallVector<Type *> ElementTypes;
ElementTypes.reserve(ST->getNumElements());
for (Type *ElTy : ST->elements()) {
if (isa<PaddingExtType>(ElTy))
continue;
ElementTypes.push_back(getTypeWithoutPadding(ElTy));
}

// Handle explicitly padded cbuffer arrays like { [ n x paddedty ], ty }
if (ElementTypes.size() == 2)
if (auto *AT = dyn_cast<ArrayType>(ElementTypes[0]))
if (ElementTypes[1] == AT->getElementType())
return ArrayType::get(ElementTypes[1], AT->getNumElements() + 1);

// If we only have a single element, don't wrap it in a struct.
if (ElementTypes.size() == 1)
return ElementTypes[0];

return StructType::get(Ctx, ElementTypes, /*IsPacked=*/false);
}
// Arrays just need to have their element type adjusted.
if (auto *AT = dyn_cast<ArrayType>(Ty))
return ArrayType::get(getTypeWithoutPadding(AT->getElementType()),
AT->getNumElements());
// Anything else should be good as is.
return Ty;
}

StructType *ResourceTypeInfo::createElementStruct(StringRef CBufferName) {
SmallString<64> TypeName;

Expand Down Expand Up @@ -334,14 +366,21 @@ StructType *ResourceTypeInfo::createElementStruct(StringRef CBufferName) {
}
case ResourceKind::CBuffer: {
auto *RTy = cast<CBufferExtType>(HandleTy);
LayoutExtType *LayoutType = cast<LayoutExtType>(RTy->getResourceType());
StructType *Ty = cast<StructType>(LayoutType->getWrappedType());
SmallString<64> Name = getResourceKindName(Kind);
if (!CBufferName.empty()) {
Name.append(".");
Name.append(CBufferName);
}
return StructType::create(Ty->elements(), Name);

// TODO: Remove this when we update the frontend to use explicit padding.
if (LayoutExtType *LayoutType =
dyn_cast<LayoutExtType>(RTy->getResourceType())) {
StructType *Ty = cast<StructType>(LayoutType->getWrappedType());
return StructType::create(Ty->elements(), Name);
}

return getOrCreateElementStruct(
getTypeWithoutPadding(RTy->getResourceType()), Name);
}
case ResourceKind::Sampler: {
auto *RTy = cast<SamplerExtType>(HandleTy);
Expand Down Expand Up @@ -454,10 +493,10 @@ uint32_t ResourceTypeInfo::getCBufferSize(const DataLayout &DL) const {

Type *ElTy = cast<CBufferExtType>(HandleTy)->getResourceType();

// TODO: Remove this when we update the frontend to use explicit padding.
if (auto *LayoutTy = dyn_cast<LayoutExtType>(ElTy))
return LayoutTy->getSize();

// TODO: What should we do with unannotated arrays?
return DL.getTypeAllocSize(ElTy);
}

Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/IR/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,10 @@ static TargetTypeInfo getTargetTypeInfo(const TargetExtType *Ty) {
}

// DirectX resources
if (Name == "dx.Padding")
return TargetTypeInfo(
ArrayType::get(Type::getInt8Ty(C), Ty->getIntParameter(0)),
TargetExtType::CanBeGlobal);
if (Name.starts_with("dx."))
return TargetTypeInfo(PointerType::get(C, 0), TargetExtType::CanBeGlobal,
TargetExtType::CanBeLocal,
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Analysis/DXILResource/buffer-frombinding.ll
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ define void @test_typedbuffer() {
; CHECK: Kind: CBuffer
; CHECK: CBuffer size: 4

%cb1 = call target("dx.CBuffer", target("dx.Layout", {float}, 4, 0))
%cb1 = call target("dx.CBuffer", <{ [2 x <{ float, target("dx.Padding", 12) }>], float }>)
@llvm.dx.resource.handlefrombinding(i32 1, i32 8, i32 1, i32 0, ptr @Constants.str)
; CHECK: Resource [[CB1:[0-9]+]]:
; CHECK: Name: Constants
Expand All @@ -161,7 +161,7 @@ define void @test_typedbuffer() {
; CHECK: Size: 1
; CHECK: Class: CBV
; CHECK: Kind: CBuffer
; CHECK: CBuffer size: 4
; CHECK: CBuffer size: 36

; CHECK-NOT: Resource {{[0-9]+}}:

Expand Down
12 changes: 6 additions & 6 deletions llvm/test/CodeGen/DirectX/CBufferLoadLegacy-errors.ll
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ declare void @f16_user(half)
; CHECK-SAME: in function four64
; CHECK-SAME: Type mismatch between intrinsic and DXIL op
define void @four64() "hlsl.export" {
%buffer = call target("dx.CBuffer", target("dx.Layout", {double}, 8, 0))
%buffer = call target("dx.CBuffer", <{ double }>)
@llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr null)

%load = call {double, double, double, double} @llvm.dx.resource.load.cbufferrow.4(
target("dx.CBuffer", target("dx.Layout", {double}, 8, 0)) %buffer,
target("dx.CBuffer", <{ double }>) %buffer,
i32 0)
%data = extractvalue {double, double, double, double} %load, 0

Expand All @@ -28,11 +28,11 @@ define void @four64() "hlsl.export" {
; CHECK-SAME: in function two32
; CHECK-SAME: Type mismatch between intrinsic and DXIL op
define void @two32() "hlsl.export" {
%buffer = call target("dx.CBuffer", target("dx.Layout", {float}, 4, 0))
%buffer = call target("dx.CBuffer", <{ float }>)
@llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr null)

%load = call {float, float} @llvm.dx.resource.load.cbufferrow.2(
target("dx.CBuffer", target("dx.Layout", {float}, 4, 0)) %buffer,
target("dx.CBuffer", <{ float }>) %buffer,
i32 0)
%data = extractvalue {float, float} %load, 0

Expand All @@ -41,5 +41,5 @@ define void @two32() "hlsl.export" {
ret void
}

declare { double, double, double, double } @llvm.dx.resource.load.cbufferrow.4.f64.f64.f64.f64.tdx.CBuffer_tdx.Layout_sl_f64s_8_0tt(target("dx.CBuffer", target("dx.Layout", { double }, 8, 0)), i32)
declare { float, float } @llvm.dx.resource.load.cbufferrow.2.f32.f32.tdx.CBuffer_tdx.Layout_sl_f32s_4_0tt(target("dx.CBuffer", target("dx.Layout", { float }, 4, 0)), i32)
declare { double, double, double, double } @llvm.dx.resource.load.cbufferrow.4.f64.f64.f64.f64.tdx.CBuffer_sl_f64st(target("dx.CBuffer", <{ double }>), i32)
declare { float, float } @llvm.dx.resource.load.cbufferrow.2.f32.f32.tdx.CBuffer_sl_f32st(target("dx.CBuffer", <{ float }>), i32)
12 changes: 6 additions & 6 deletions llvm/test/CodeGen/DirectX/CBufferLoadLegacy.ll
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ declare void @f16_user(half)

; CHECK-LABEL: define void @loadf32
define void @loadf32() {
%buffer = call target("dx.CBuffer", target("dx.Layout", {float}, 4, 0))
%buffer = call target("dx.CBuffer", <{ float }>)
@llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr null)

; CHECK: [[DATA:%.*]] = call %dx.types.CBufRet.f32 @dx.op.cbufferLoadLegacy.f32(i32 59, %dx.types.Handle %{{.*}}, i32 0)
%load = call {float, float, float, float} @llvm.dx.resource.load.cbufferrow.4(
target("dx.CBuffer", target("dx.Layout", {float}, 4, 0)) %buffer,
target("dx.CBuffer", <{ float }>) %buffer,
i32 0)
%data = extractvalue {float, float, float, float} %load, 0

Expand All @@ -27,12 +27,12 @@ define void @loadf32() {
; CHECK-LABEL: define void @loadf64
define void @loadf64() {
%buffer = call
target("dx.CBuffer", target("dx.Layout", {double, double, double, double}, 64, 0, 8, 16, 24))
target("dx.CBuffer", <{ <4 x double> }>)
@llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr null)

; CHECK: [[DATA:%.*]] = call %dx.types.CBufRet.f64 @dx.op.cbufferLoadLegacy.f64(i32 59, %dx.types.Handle %{{.*}}, i32 1)
%load = call {double, double} @llvm.dx.resource.load.cbufferrow.2(
target("dx.CBuffer", target("dx.Layout", {double, double, double, double}, 64, 0, 8, 16, 24)) %buffer,
target("dx.CBuffer", <{ <4 x double> }>) %buffer,
i32 1)
%data = extractvalue {double, double} %load, 1

Expand All @@ -46,12 +46,12 @@ define void @loadf64() {
; CHECK-LABEL: define void @loadf16
define void @loadf16() {
%buffer = call
target("dx.CBuffer", target("dx.Layout", {half}, 2, 0))
target("dx.CBuffer", <{ half }>)
@llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr null)

; CHECK: [[DATA:%.*]] = call %dx.types.CBufRet.f16.8 @dx.op.cbufferLoadLegacy.f16(i32 59, %dx.types.Handle %{{.*}}, i32 0)
%load = call {half, half, half, half, half, half, half, half} @llvm.dx.resource.load.cbufferrow.8(
target("dx.CBuffer", target("dx.Layout", {half}, 2, 0)) %buffer,
target("dx.CBuffer", <{ half }>) %buffer,
i32 0)
%data = extractvalue {half, half, half, half, half, half, half, half} %load, 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ define void @main() #0 {
%srv0 = call target("dx.RawBuffer", i8, 0, 0)
@llvm.dx.resource.handlefrombinding.tdx.RawBuffer_i8_0_0t(
i32 1, i32 8, i32 1, i32 0, ptr null)
%cbuf = call target("dx.CBuffer", target("dx.Layout", {float}, 4, 0))
%cbuf = call target("dx.CBuffer", <{ float }>)
@llvm.dx.resource.handlefrombinding(i32 3, i32 2, i32 1, i32 0, ptr null)
ret void
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/DirectX/ContainerData/PSVResources.ll
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ define void @main() #0 {
; CHECK: Kind: CBuffer
; CHECK: Flags:
; CHECK: UsedByAtomic64: false
%cbuf = call target("dx.CBuffer", target("dx.Layout", {float}, 4, 0))
%cbuf = call target("dx.CBuffer", <{ float }>)
@llvm.dx.resource.handlefrombinding(i32 3, i32 2, i32 1, i32 0, ptr null)

; ByteAddressBuffer Buf : register(t8, space1)
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/DirectX/CreateHandleFromBinding.ll
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ define void @test_bindings() {
; CHECK: call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[BUF5]], %dx.types.ResourceProperties { i32 10, i32 1033 }) #[[#ATTR]]

; cbuffer cb0 : register(b0) { int4 i; float4 f; }
%cb0 = call target("dx.CBuffer", target("dx.Layout", {<4 x i32>, <4 x float>}, 32, 0, 16))
%cb0 = call target("dx.CBuffer", <{ <4 x i32>, <4 x float> }>)
@llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr null)
; CHECK: [[BUF6:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 0, i32 0, i32 0, i8 2 }, i32 0, i1 false) #[[#ATTR]]
; CHECK: call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[BUF6]], %dx.types.ResourceProperties { i32 13, i32 32 }) #[[#ATTR]]
Expand Down
20 changes: 10 additions & 10 deletions llvm/test/CodeGen/DirectX/ForwardHandleAccesses/cbuffer-access.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@
%__cblayout_CB2 = type <{ float }>
%struct.Scalars = type { float, i32, i32 }

@CB.cb = local_unnamed_addr global target("dx.CBuffer", target("dx.Layout", %__cblayout_CB, 12, 0, 4, 8)) poison
@CB2.cb = local_unnamed_addr global target("dx.CBuffer", target("dx.Layout", %__cblayout_CB2, 4, 0)) poison
@CB.cb = local_unnamed_addr global target("dx.CBuffer", %__cblayout_CB) poison
@CB2.cb = local_unnamed_addr global target("dx.CBuffer", %__cblayout_CB2) poison

define void @main() local_unnamed_addr #1 {
entry:
; CHECK: [[CB:%.*]] = tail call target({{.*}}) @llvm.dx.resource.handlefrombinding
%h = tail call target("dx.CBuffer", target("dx.Layout", %__cblayout_CB, 12, 0, 4, 8)) @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr null)
store target("dx.CBuffer", target("dx.Layout", %__cblayout_CB, 12, 0, 4, 8)) %h, ptr @CB.cb, align 4
%h = tail call target("dx.CBuffer", %__cblayout_CB) @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr null)
store target("dx.CBuffer", %__cblayout_CB) %h, ptr @CB.cb, align 4
%_ZL3Out_h.i.i = tail call target("dx.RawBuffer", %struct.Scalars, 1, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr null)
; CHECK-NOT: load target({{.*}}), ptr @CB.cb
%cb = load target("dx.CBuffer", target("dx.Layout", %__cblayout_CB, 12, 0, 4, 8)), ptr @CB.cb, align 4
%cb = load target("dx.CBuffer", %__cblayout_CB), ptr @CB.cb, align 4
; CHECK: call { float, float, float, float } @llvm.dx.resource.load.cbufferrow.4.{{.*}}(target({{.*}}) [[CB]], i32 0)
%0 = call { float, float, float, float } @llvm.dx.resource.load.cbufferrow.4(target("dx.CBuffer", target("dx.Layout", %__cblayout_CB, 12, 0, 4, 8)) %cb, i32 0)
%0 = call { float, float, float, float } @llvm.dx.resource.load.cbufferrow.4(target("dx.CBuffer", %__cblayout_CB) %cb, i32 0)
%1 = extractvalue { float, float, float, float } %0, 0
call void @llvm.dx.resource.store.rawbuffer(target("dx.RawBuffer", %struct.Scalars, 1, 0) %_ZL3Out_h.i.i, i32 0, i32 0, float %1)

; CHECK: [[CB2:%.*]] = tail call target({{.*}}) @llvm.dx.resource.handlefromimplicitbinding
%h2 = tail call target("dx.CBuffer", target("dx.Layout", %__cblayout_CB2, 4, 0)) @llvm.dx.resource.handlefromimplicitbinding(i32 100, i32 0, i32 1, i32 0, ptr null)
store target("dx.CBuffer", target("dx.Layout", %__cblayout_CB2, 4, 0)) %h2, ptr @CB2.cb, align 4
%h2 = tail call target("dx.CBuffer", %__cblayout_CB2) @llvm.dx.resource.handlefromimplicitbinding(i32 100, i32 0, i32 1, i32 0, ptr null)
store target("dx.CBuffer", %__cblayout_CB2) %h2, ptr @CB2.cb, align 4
; CHECK-NOT: load target({{.*}}), ptr @CB2.cb
%cb2 = load target("dx.CBuffer", target("dx.Layout", %__cblayout_CB2, 4, 0)), ptr @CB2.cb, align 4
%cb2 = load target("dx.CBuffer", %__cblayout_CB2), ptr @CB2.cb, align 4

ret void
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
; TODO: Remove this test once we've updated the frontend to use explicit
; padding. The cbuffer-metadata.ll test covers the newer logic.

; RUN: opt -S -dxil-translate-metadata < %s | FileCheck %s
; RUN: opt -S --passes="dxil-pretty-printer" < %s 2>&1 | FileCheck %s --check-prefix=PRINT
; RUN: llc %s --filetype=asm -o - < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,PRINT
Expand Down
89 changes: 89 additions & 0 deletions llvm/test/CodeGen/DirectX/Metadata/cbuffer-metadata.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
; RUN: opt -S -dxil-translate-metadata < %s | FileCheck %s
; RUN: opt -S --passes="dxil-pretty-printer" < %s 2>&1 | FileCheck %s --check-prefix=PRINT
; RUN: llc %s --filetype=asm -o - < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,PRINT

target triple = "dxil-pc-shadermodel6.6-compute"

%__cblayout_CB1 = type <{ float, i32, double, <2 x i32> }>
@CB1.cb = global target("dx.CBuffer", %__cblayout_CB1) poison
@CB1.str = private unnamed_addr constant [4 x i8] c"CB1\00", align 1

%__cblayout_CB2 = type <{ float, target("dx.Padding", 4), double, float, half, i16, i64, i32 }>
@CB2.cb = global target("dx.CBuffer", %__cblayout_CB2) poison
@CB2.str = private unnamed_addr constant [4 x i8] c"CB2\00", align 1

%__cblayout_MyConstants = type <{
double, target("dx.Padding", 8),
<3 x float>, float,
<3 x double>, half, target("dx.Padding", 6),
<2 x double>,
float, <3 x half>, <3 x half>
}>
@MyConstants.cb = global target("dx.CBuffer", %__cblayout_MyConstants) poison
@MyConstants.str = private unnamed_addr constant [12 x i8] c"MyConstants\00", align 1

; PRINT:; Resource Bindings:
; PRINT-NEXT:;
; PRINT-NEXT:; Name Type Format Dim ID HLSL Bind Count
; PRINT-NEXT:; ----
; PRINT-NEXT:; CB1 cbuffer NA NA CB0 cb0 1
; PRINT-NEXT:; CB2 cbuffer NA NA CB1 cb1 1
; PRINT-NEXT:; MyConstants cbuffer NA NA CB2 cb5,space15 1

define void @test() #0 {

; cbuffer CB1 : register(b0) {
; float a;
; int b;
; double c;
; int2 d;
; }
%CB1.cb_h = call target("dx.CBuffer", %__cblayout_CB1)
@llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr @CB1.str)

; cbuffer CB2 : register(b0) {
; float a;
; double b;
; float c;
; half d;
; uint16_t e;
; int64_t f;
; int g;
;}
%CB2.cb_h = call target("dx.CBuffer", %__cblayout_CB2)
@llvm.dx.resource.handlefrombinding(i32 0, i32 1, i32 1, i32 0, ptr @CB2.str)

; cbuffer CB3 : register(b5) {
; double B0;
; float3 B1;
; float B2;
; double3 B3;
; half B4;
; double2 B5;
; float B6;
; half3 B7;
; half3 B8;
; }
%CB3.cb_h = call target("dx.CBuffer", %__cblayout_MyConstants)
@llvm.dx.resource.handlefrombinding(i32 15, i32 5, i32 1, i32 0, ptr @MyConstants.str)

ret void
}

attributes #0 = { noinline nounwind "hlsl.shader"="compute" }

; CHECK: %CBuffer.CB1 = type { { float, i32, double, <2 x i32> } }
; CHECK: %CBuffer.CB2 = type { { float, double, float, half, i16, i64, i32 } }
; CHECK: %CBuffer.MyConstants = type { { double, <3 x float>, float, <3 x double>, half, <2 x double>, float, <3 x half>, <3 x half> } }

; CHECK: @CB1 = external constant %CBuffer.CB1
; CHECK: @CB2 = external constant %CBuffer.CB2
; CHECK: @MyConstants = external constant %CBuffer.MyConstants

; CHECK: !dx.resources = !{[[ResList:[!][0-9]+]]}

; CHECK: [[ResList]] = !{null, null, [[CBList:[!][0-9]+]], null}
; CHECK: [[CBList]] = !{![[CB1:[0-9]+]], ![[CB2:[0-9]+]], ![[MYCONSTANTS:[0-9]+]]}
; CHECK: ![[CB1]] = !{i32 0, ptr @CB1, !"CB1", i32 0, i32 0, i32 1, i32 24, null}
; CHECK: ![[CB2]] = !{i32 1, ptr @CB2, !"CB2", i32 0, i32 1, i32 1, i32 36, null}
; CHECK: ![[MYCONSTANTS]] = !{i32 2, ptr @MyConstants, !"MyConstants", i32 15, i32 5, i32 1, i32 96, null}
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/DirectX/Metadata/cbuffer-only.ll
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
target triple = "dxil-pc-shadermodel6.6-compute"

define void @cbuffer_is_only_binding() {
%cbuf = call target("dx.CBuffer", target("dx.Layout", {float}, 4, 0))
%cbuf = call target("dx.CBuffer", <{ float }>)
@llvm.dx.resource.handlefrombinding(i32 1, i32 8, i32 1, i32 0, ptr null)
; CHECK: %CBuffer = type { float }

Expand Down
4 changes: 1 addition & 3 deletions llvm/unittests/Analysis/DXILResourceTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,8 @@ TEST(DXILResource, AnnotationsAndMetadata) {
{
StructType *CBufStruct =
StructType::create(Context, {Floatx4Ty, Floatx4Ty}, "cb0");
TargetExtType *CBufLayoutType =
llvm::TargetExtType::get(Context, "dx.Layout", CBufStruct, {32, 0, 16});
ResourceTypeInfo RTI(
llvm::TargetExtType::get(Context, "dx.CBuffer", CBufLayoutType));
llvm::TargetExtType::get(Context, "dx.CBuffer", CBufStruct));
EXPECT_EQ(RTI.getResourceClass(), ResourceClass::CBuffer);
EXPECT_EQ(RTI.getCBufferSize(DL), 32u);
EXPECT_EQ(RTI.getResourceKind(), ResourceKind::CBuffer);
Expand Down