Skip to content

Commit f42d017

Browse files
committed
[HLSL] Add resource name argument to resource class constructors
1 parent d82236d commit f42d017

9 files changed

+101
-66
lines changed

clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ struct BuiltinTypeMethodBuilder {
120120
// LastStmt - refers to the last statement in the method body; referencing
121121
// LastStmt will remove the statement from the method body since
122122
// it will be linked from the new expression being constructed.
123-
enum class PlaceHolder { _0, _1, _2, _3, Handle = 128, LastStmt };
123+
enum class PlaceHolder { _0, _1, _2, _3, _4, Handle = 128, LastStmt };
124124

125125
Expr *convertPlaceholder(PlaceHolder PH);
126126
Expr *convertPlaceholder(Expr *E) { return E; }
@@ -662,8 +662,9 @@ BuiltinTypeDeclBuilder::addHandleConstructorFromBinding() {
662662
.addParam("spaceNo", AST.UnsignedIntTy)
663663
.addParam("range", AST.IntTy)
664664
.addParam("index", AST.UnsignedIntTy)
665+
.addParam("name", AST.getPointerType(AST.CharTy.withConst()))
665666
.callBuiltin("__builtin_hlsl_resource_handlefrombinding", HandleType,
666-
PH::Handle, PH::_0, PH::_1, PH::_2, PH::_3)
667+
PH::Handle, PH::_0, PH::_1, PH::_2, PH::_3, PH::_4)
667668
.assign(PH::Handle, PH::LastStmt)
668669
.finalize();
669670
}
@@ -682,8 +683,10 @@ BuiltinTypeDeclBuilder::addHandleConstructorFromImplicitBinding() {
682683
.addParam("range", AST.IntTy)
683684
.addParam("index", AST.UnsignedIntTy)
684685
.addParam("orderId", AST.UnsignedIntTy)
686+
.addParam("name", AST.getPointerType(AST.CharTy.withConst()))
685687
.callBuiltin("__builtin_hlsl_resource_handlefromimplicitbinding",
686-
HandleType, PH::Handle, PH::_0, PH::_1, PH::_2, PH::_3)
688+
HandleType, PH::Handle, PH::_0, PH::_1, PH::_2, PH::_3,
689+
PH::_4)
687690
.assign(PH::Handle, PH::LastStmt)
688691
.finalize();
689692
}

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2464,12 +2464,14 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
24642464
}
24652465
case Builtin::BI__builtin_hlsl_resource_handlefrombinding: {
24662466
ASTContext &AST = SemaRef.getASTContext();
2467-
if (SemaRef.checkArgCount(TheCall, 5) ||
2467+
if (SemaRef.checkArgCount(TheCall, 6) ||
24682468
CheckResourceHandle(&SemaRef, TheCall, 0) ||
24692469
CheckArgTypeMatches(&SemaRef, TheCall->getArg(1), AST.UnsignedIntTy) ||
24702470
CheckArgTypeMatches(&SemaRef, TheCall->getArg(2), AST.UnsignedIntTy) ||
24712471
CheckArgTypeMatches(&SemaRef, TheCall->getArg(3), AST.IntTy) ||
2472-
CheckArgTypeMatches(&SemaRef, TheCall->getArg(4), AST.UnsignedIntTy))
2472+
CheckArgTypeMatches(&SemaRef, TheCall->getArg(4), AST.UnsignedIntTy) ||
2473+
CheckArgTypeMatches(&SemaRef, TheCall->getArg(5),
2474+
AST.getPointerType(AST.CharTy.withConst())))
24732475
return true;
24742476
// use the type of the handle (arg0) as a return type
24752477
QualType ResourceTy = TheCall->getArg(0)->getType();
@@ -2478,12 +2480,14 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
24782480
}
24792481
case Builtin::BI__builtin_hlsl_resource_handlefromimplicitbinding: {
24802482
ASTContext &AST = SemaRef.getASTContext();
2481-
if (SemaRef.checkArgCount(TheCall, 5) ||
2483+
if (SemaRef.checkArgCount(TheCall, 6) ||
24822484
CheckResourceHandle(&SemaRef, TheCall, 0) ||
24832485
CheckArgTypeMatches(&SemaRef, TheCall->getArg(1), AST.UnsignedIntTy) ||
24842486
CheckArgTypeMatches(&SemaRef, TheCall->getArg(2), AST.IntTy) ||
24852487
CheckArgTypeMatches(&SemaRef, TheCall->getArg(3), AST.UnsignedIntTy) ||
2486-
CheckArgTypeMatches(&SemaRef, TheCall->getArg(4), AST.UnsignedIntTy))
2488+
CheckArgTypeMatches(&SemaRef, TheCall->getArg(4), AST.UnsignedIntTy) ||
2489+
CheckArgTypeMatches(&SemaRef, TheCall->getArg(5),
2490+
AST.getPointerType(AST.CharTy.withConst())))
24872491
return true;
24882492
// use the type of the handle (arg0) as a return type
24892493
QualType ResourceTy = TheCall->getArg(0)->getType();
@@ -3354,21 +3358,26 @@ bool SemaHLSL::initGlobalResourceDecl(VarDecl *VD) {
33543358
IntegerLiteral *Space =
33553359
IntegerLiteral::Create(AST, llvm::APInt(UIntTySize, SpaceNo),
33563360
AST.UnsignedIntTy, SourceLocation());
3361+
StringRef VarName = VD->getName();
3362+
StringLiteral *Name = StringLiteral::Create(
3363+
AST, VarName, StringLiteralKind::Ordinary, false,
3364+
AST.getStringLiteralArrayType(AST.CharTy.withConst(), VarName.size()),
3365+
SourceLocation());
33573366

33583367
// resource with explicit binding
33593368
if (RegisterSlot.has_value()) {
33603369
IntegerLiteral *RegSlot = IntegerLiteral::Create(
33613370
AST, llvm::APInt(UIntTySize, RegisterSlot.value()), AST.UnsignedIntTy,
33623371
SourceLocation());
3363-
Expr *Args[] = {RegSlot, Space, RangeSize, Index};
3372+
Expr *Args[] = {RegSlot, Space, RangeSize, Index, Name};
33643373
return initVarDeclWithCtor(SemaRef, VD, Args);
33653374
}
33663375

33673376
// resource with implicit binding
33683377
IntegerLiteral *OrderId = IntegerLiteral::Create(
33693378
AST, llvm::APInt(UIntTySize, getNextImplicitBindingOrderID()),
33703379
AST.UnsignedIntTy, SourceLocation());
3371-
Expr *Args[] = {Space, RangeSize, Index, OrderId};
3380+
Expr *Args[] = {Space, RangeSize, Index, OrderId, Name};
33723381
return initVarDeclWithCtor(SemaRef, VD, Args);
33733382
}
33743383

clang/test/AST/HLSL/ByteAddressBuffers-AST.hlsl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,12 @@ RESOURCE Buffer;
5858

5959
// Constructor from binding
6060

61-
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]] 'void (unsigned int, unsigned int, int, unsigned int)' inline
61+
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]] 'void (unsigned int, unsigned int, int, unsigned int, const char *)' inline
6262
// CHECK-NEXT: ParmVarDecl {{.*}} registerNo 'unsigned int'
6363
// CHECK-NEXT: ParmVarDecl {{.*}} spaceNo 'unsigned int'
6464
// CHECK-NEXT: ParmVarDecl {{.*}} range 'int'
6565
// CHECK-NEXT: ParmVarDecl {{.*}} index 'unsigned int'
66+
// CHECK-NEXT: ParmVarDecl {{.*}} name 'const char *'
6667
// CHECK-NEXT: CompoundStmt {{.*}}
6768
// CHECK-NEXT: BinaryOperator {{.*}} '='
6869
// CHECK-NEXT: MemberExpr {{.*}} lvalue .__handle
@@ -76,15 +77,17 @@ RESOURCE Buffer;
7677
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'spaceNo' 'unsigned int'
7778
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' ParmVar {{.*}} 'range' 'int'
7879
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'index' 'unsigned int'
80+
// CHECK-NEXT: DeclRefExpr {{.*}} 'const char *' ParmVar {{.*}} 'name' 'const char *'
7981
// CHECK-NEXT: AlwaysInlineAttr
8082

8183
// Constructor from implicit binding
8284

83-
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]] 'void (unsigned int, int, unsigned int, unsigned int)' inline
85+
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]] 'void (unsigned int, int, unsigned int, unsigned int, const char *)' inline
8486
// CHECK-NEXT: ParmVarDecl {{.*}} spaceNo 'unsigned int'
8587
// CHECK-NEXT: ParmVarDecl {{.*}} range 'int'
8688
// CHECK-NEXT: ParmVarDecl {{.*}} index 'unsigned int'
8789
// CHECK-NEXT: ParmVarDecl {{.*}} orderId 'unsigned int'
90+
// CHECK-NEXT: ParmVarDecl {{.*}} name 'const char *'
8891
// CHECK-NEXT: CompoundStmt {{.*}}
8992
// CHECK-NEXT: BinaryOperator {{.*}} '='
9093
// CHECK-NEXT: MemberExpr {{.*}} lvalue .__handle
@@ -98,6 +101,7 @@ RESOURCE Buffer;
98101
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' ParmVar {{.*}} 'range' 'int'
99102
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'index' 'unsigned int'
100103
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'orderId' 'unsigned int'
104+
// CHECK-NEXT: DeclRefExpr {{.*}} 'const char *' ParmVar {{.*}} 'name' 'const char *'
101105
// CHECK-NEXT: AlwaysInlineAttr
102106

103107
// CHECK-NOSUBSCRIPT-NOT: CXXMethodDecl {{.*}} operator[] 'const element_type &(unsigned int) const'

clang/test/AST/HLSL/StructuredBuffers-AST.hlsl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,12 @@ RESOURCE<float> Buffer;
105105

106106
// Constructor from binding
107107

108-
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]]<element_type> 'void (unsigned int, unsigned int, int, unsigned int)' inline
108+
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]]<element_type> 'void (unsigned int, unsigned int, int, unsigned int, const char *)' inline
109109
// CHECK-NEXT: ParmVarDecl {{.*}} registerNo 'unsigned int'
110110
// CHECK-NEXT: ParmVarDecl {{.*}} spaceNo 'unsigned int'
111111
// CHECK-NEXT: ParmVarDecl {{.*}} range 'int'
112112
// CHECK-NEXT: ParmVarDecl {{.*}} index 'unsigned int'
113+
// CHECK-NEXT: ParmVarDecl {{.*}} name 'const char *'
113114
// CHECK-NEXT: CompoundStmt {{.*}}
114115
// CHECK-NEXT: BinaryOperator {{.*}} '='
115116
// CHECK-NEXT: MemberExpr {{.*}} lvalue .__handle
@@ -123,15 +124,17 @@ RESOURCE<float> Buffer;
123124
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'spaceNo' 'unsigned int'
124125
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' ParmVar {{.*}} 'range' 'int'
125126
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'index' 'unsigned int'
127+
// CHECK-NEXT: DeclRefExpr {{.*}} 'const char *' ParmVar {{.*}} 'name' 'const char *'
126128
// CHECK-NEXT: AlwaysInlineAttr
127129

128130
// Constructor from implicit binding
129131

130-
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]]<element_type> 'void (unsigned int, int, unsigned int, unsigned int)' inline
132+
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]]<element_type> 'void (unsigned int, int, unsigned int, unsigned int, const char *)' inline
131133
// CHECK-NEXT: ParmVarDecl {{.*}} spaceNo 'unsigned int'
132134
// CHECK-NEXT: ParmVarDecl {{.*}} range 'int'
133135
// CHECK-NEXT: ParmVarDecl {{.*}} index 'unsigned int'
134136
// CHECK-NEXT: ParmVarDecl {{.*}} orderId 'unsigned int'
137+
// CHECK-NEXT: ParmVarDecl {{.*}} name 'const char *'
135138
// CHECK-NEXT: CompoundStmt {{.*}}
136139
// CHECK-NEXT: BinaryOperator {{.*}} '='
137140
// CHECK-NEXT: MemberExpr {{.*}} lvalue .__handle
@@ -145,6 +148,7 @@ RESOURCE<float> Buffer;
145148
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' ParmVar {{.*}} 'range' 'int'
146149
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'index' 'unsigned int'
147150
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'orderId' 'unsigned int'
151+
// CHECK-NEXT: DeclRefExpr {{.*}} 'const char *' ParmVar {{.*}} 'name' 'const char *'
148152
// CHECK-NEXT: AlwaysInlineAttr
149153

150154
// Subscript operators

clang/test/AST/HLSL/TypedBuffers-AST.hlsl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,12 @@ RESOURCE<float> Buffer;
7272

7373
// Constructor from binding
7474

75-
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]]<element_type> 'void (unsigned int, unsigned int, int, unsigned int)' inline
75+
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]]<element_type> 'void (unsigned int, unsigned int, int, unsigned int, const char *)' inline
7676
// CHECK-NEXT: ParmVarDecl {{.*}} registerNo 'unsigned int'
7777
// CHECK-NEXT: ParmVarDecl {{.*}} spaceNo 'unsigned int'
7878
// CHECK-NEXT: ParmVarDecl {{.*}} range 'int'
7979
// CHECK-NEXT: ParmVarDecl {{.*}} index 'unsigned int'
80+
// CHECK-NEXT: ParmVarDecl {{.*}} name 'const char *'
8081
// CHECK-NEXT: CompoundStmt {{.*}}
8182
// CHECK-NEXT: BinaryOperator {{.*}} '='
8283
// CHECK-NEXT: MemberExpr {{.*}} lvalue .__handle
@@ -90,15 +91,17 @@ RESOURCE<float> Buffer;
9091
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'spaceNo' 'unsigned int'
9192
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' ParmVar {{.*}} 'range' 'int'
9293
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'index' 'unsigned int'
94+
// CHECK-NEXT: DeclRefExpr {{.*}} 'const char *' ParmVar {{.*}} 'name' 'const char *'
9395
// CHECK-NEXT: AlwaysInlineAttr
9496

9597
// Constructor from implicit binding
9698

97-
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]]<element_type> 'void (unsigned int, int, unsigned int, unsigned int)' inline
99+
// CHECK: CXXConstructorDecl {{.*}} [[RESOURCE]]<element_type> 'void (unsigned int, int, unsigned int, unsigned int, const char *)' inline
98100
// CHECK-NEXT: ParmVarDecl {{.*}} spaceNo 'unsigned int'
99101
// CHECK-NEXT: ParmVarDecl {{.*}} range 'int'
100102
// CHECK-NEXT: ParmVarDecl {{.*}} index 'unsigned int'
101103
// CHECK-NEXT: ParmVarDecl {{.*}} orderId 'unsigned int'
104+
// CHECK-NEXT: ParmVarDecl {{.*}} name 'const char *'
102105
// CHECK-NEXT: CompoundStmt {{.*}}
103106
// CHECK-NEXT: BinaryOperator {{.*}} '='
104107
// CHECK-NEXT: MemberExpr {{.*}} lvalue .__handle
@@ -112,6 +115,7 @@ RESOURCE<float> Buffer;
112115
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' ParmVar {{.*}} 'range' 'int'
113116
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'index' 'unsigned int'
114117
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'orderId' 'unsigned int'
118+
// CHECK-NEXT: DeclRefExpr {{.*}} 'const char *' ParmVar {{.*}} 'name' 'const char *'
115119
// CHECK-NEXT: AlwaysInlineAttr
116120

117121
// Subsctript operators

clang/test/CodeGenHLSL/GlobalConstructorLib.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void SecondEntry() {}
3333

3434
// Verify the constructor is alwaysinline
3535
// NOINLINE: ; Function Attrs: {{.*}}alwaysinline
36-
// NOINLINE-NEXT: define linkonce_odr void @_ZN4hlsl8RWBufferIfEC2Ejijj({{.*}} [[CtorAttr:\#[0-9]+]]
36+
// NOINLINE-NEXT: define linkonce_odr void @_ZN4hlsl8RWBufferIfEC2EjijjPKc({{.*}} [[CtorAttr:\#[0-9]+]]
3737

3838
// NOINLINE: ; Function Attrs: {{.*}}alwaysinline
3939
// NOINLINE-NEXT: define internal void @_GLOBAL__sub_I_GlobalConstructorLib.hlsl() [[InitAttr:\#[0-9]+]]

clang/test/CodeGenHLSL/builtins/ByteAddressBuffers-constructors.hlsl

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,33 @@ export void foo() {
2424
// CHECK: %"class.hlsl::RasterizerOrderedByteAddressBuffer" = type { target("dx.RawBuffer", i8, 1, 1) }
2525

2626
// CHECK: @_ZL4Buf1 = internal global %"class.hlsl::ByteAddressBuffer" poison, align 4
27+
// CHECK: @[[Buf1Str:.*]] = private unnamed_addr constant [5 x i8] c"Buf1\00", align 1
2728
// CHECK: @_ZL4Buf2 = internal global %"class.hlsl::RWByteAddressBuffer" poison, align 4
29+
// CHECK: @[[Buf2Str:.*]] = private unnamed_addr constant [5 x i8] c"Buf2\00", align 1
2830

2931
// Buf1 initialization part 1 - global init function that calls ByteAddressBuffer C1 constructor with explicit binding
3032
// CHECK: define internal void @__cxx_global_var_init()
3133
// CHECK-NEXT: entry:
32-
// CHECK-NEXT: call void @_ZN4hlsl17ByteAddressBufferC1Ejjij(ptr noundef nonnull align 4 dereferenceable(4) @_ZL4Buf1,
33-
// CHECK-SAME: i32 noundef 1, i32 noundef 2, i32 noundef 1, i32 noundef 0)
34+
// CHECK-NEXT: call void @_ZN4hlsl17ByteAddressBufferC1EjjijPKc(ptr noundef nonnull align 4 dereferenceable(4) @_ZL4Buf1,
35+
// CHECK-SAME: i32 noundef 1, i32 noundef 2, i32 noundef 1, i32 noundef 0, ptr noundef @[[Buf1Str]])
3436

3537
// Buf1 initialization part 2 - body of ByteAddressBuffer C1 constructor with explicit binding that calls the C2 constructor
36-
// CHECK: define linkonce_odr void @_ZN4hlsl17ByteAddressBufferC1Ejjij(ptr noundef nonnull align 4 dereferenceable(4) %this,
37-
// CHECK-SAME: i32 noundef %registerNo, i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index)
38-
// CHECK: call void @_ZN4hlsl17ByteAddressBufferC2Ejjij(ptr noundef nonnull align 4 dereferenceable(4)
39-
// CHECK-SAME: %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}})
38+
// CHECK: define linkonce_odr void @_ZN4hlsl17ByteAddressBufferC1EjjijPKc(ptr noundef nonnull align 4 dereferenceable(4) %this,
39+
// CHECK-SAME: i32 noundef %registerNo, i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, ptr noundef %name)
40+
// CHECK: call void @_ZN4hlsl17ByteAddressBufferC2EjjijPKc(ptr noundef nonnull align 4 dereferenceable(4)
41+
// CHECK-SAME: %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, ptr noundef %{{.*}})
4042

4143
// Buf2 initialization part 1 - global init function that calls RWByteAddressBuffer C1 constructor with implicit binding
42-
// CHECK: define internal void @__cxx_global_var_init.1() #0 {
44+
// CHECK: define internal void @__cxx_global_var_init.1()
4345
// CHECK-NEXT: entry:
44-
// CHECK-NEXT: call void @_ZN4hlsl19RWByteAddressBufferC1Ejijj(ptr noundef nonnull align 4 dereferenceable(4) @_ZL4Buf2,
45-
// CHECK-SAME: i32 noundef 0, i32 noundef 1, i32 noundef 0, i32 noundef 0)
46+
// CHECK-NEXT: call void @_ZN4hlsl19RWByteAddressBufferC1EjijjPKc(ptr noundef nonnull align 4 dereferenceable(4) @_ZL4Buf2,
47+
// CHECK-SAME: i32 noundef 0, i32 noundef 1, i32 noundef 0, i32 noundef 0, ptr noundef @[[Buf2Str]])
4648

4749
// Buf2 initialization part 2 - body of RWByteAddressBuffer C1 constructor with implicit binding that calls the C2 constructor
48-
// CHECK: define linkonce_odr void @_ZN4hlsl19RWByteAddressBufferC1Ejijj(ptr noundef nonnull align 4 dereferenceable(4) %this,
49-
// CHECK-SAME: i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, i32 noundef %orderId)
50-
// CHECK: call void @_ZN4hlsl19RWByteAddressBufferC2Ejijj(ptr noundef nonnull align 4 dereferenceable(4) %this1, i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #4
50+
// CHECK: define linkonce_odr void @_ZN4hlsl19RWByteAddressBufferC1EjijjPKc(ptr noundef nonnull align 4 dereferenceable(4) %this,
51+
// CHECK-SAME: i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, i32 noundef %orderId, ptr noundef %name)
52+
// CHECK: call void @_ZN4hlsl19RWByteAddressBufferC2EjijjPKc(ptr noundef nonnull align 4 dereferenceable(4) %this1,
53+
// CHECK-SAME: i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, i32 noundef %{{.*}}, ptr noundef %{{.*}})
5154

5255
// Buf3 initialization part 1 - local variable declared in function foo() is initialized by
5356
// RasterizerOrderedByteAddressBuffer C1 default constructor
@@ -64,18 +67,19 @@ export void foo() {
6467

6568
// Buf1 initialization part 3 - ByteAddressBuffer C2 constructor with explicit binding that initializes
6669
// handle with @llvm.dx.resource.handlefrombinding
67-
// CHECK: define linkonce_odr void @_ZN4hlsl17ByteAddressBufferC2Ejjij(ptr noundef nonnull align 4 dereferenceable(4) %this,
68-
// CHECK-SAME: i32 noundef %registerNo, i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index)
70+
// CHECK: define linkonce_odr void @_ZN4hlsl17ByteAddressBufferC2EjjijPKc(ptr noundef nonnull align 4 dereferenceable(4) %this,
71+
// CHECK-SAME: i32 noundef %registerNo, i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, ptr noundef %name)
6972
// CHECK-DXIL: %[[HANDLE:.*]] = call target("dx.RawBuffer", i8, 0, 0) @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_i8_0_0t(
7073
// CHECK-DXIL-SAME: i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i1 false)
7174
// CHECK-NEXT: %__handle = getelementptr inbounds nuw %"class.hlsl::ByteAddressBuffer", ptr %{{.*}}, i32 0, i32 0
7275
// CHECK-DXIL-NEXT: store target("dx.RawBuffer", i8, 0, 0) %[[HANDLE]], ptr %__handle, align 4
7376

7477
// Buf2 initialization part 3 - body of RWByteAddressBuffer C2 constructor with implicit binding that initializes
7578
// handle with @llvm.dx.resource.handlefromimplicitbinding
76-
// CHECK: define linkonce_odr void @_ZN4hlsl19RWByteAddressBufferC2Ejijj(ptr noundef nonnull align 4 dereferenceable(4) %this,
77-
// CHECK-SAME: i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, i32 noundef %orderId) unnamed_addr #1 align 2 {
78-
// CHECK: %[[HANDLE:.*]] = call target("dx.RawBuffer", i8, 1, 0) @llvm.dx.resource.handlefromimplicitbinding.tdx.RawBuffer_i8_1_0t(i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i1 false)
79+
// CHECK: define linkonce_odr void @_ZN4hlsl19RWByteAddressBufferC2EjijjPKc(ptr noundef nonnull align 4 dereferenceable(4) %this,
80+
// CHECK-SAME: i32 noundef %spaceNo, i32 noundef %range, i32 noundef %index, i32 noundef %orderId, ptr noundef %name)
81+
// CHECK: %[[HANDLE:.*]] = call target("dx.RawBuffer", i8, 1, 0) @llvm.dx.resource.handlefromimplicitbinding.tdx.RawBuffer_i8_1_0t
82+
// CHECK-SAME: (i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i32 %{{.*}}, i1 false)
7983
// CHECK-NEXT: %__handle = getelementptr inbounds nuw %"class.hlsl::RWByteAddressBuffer", ptr %this1, i32 0, i32 0
8084
// CHECK-NEXT: store target("dx.RawBuffer", i8, 1, 0) %[[HANDLE]], ptr %__handle, align 4
8185

0 commit comments

Comments
 (0)