Skip to content

Commit 825673f

Browse files
author
joaosaffran
committed
adding test for null function
1 parent e4bca2b commit 825673f

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

llvm/lib/Target/DirectX/DXContainerGlobals.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ void DXContainerGlobals::addRootSignature(Module &M,
169169
if (FuncRs == RSA.end())
170170
return;
171171

172-
const RootSignatureDesc &RS = FuncRs->getSecond();
172+
const RootSignatureDesc &RS = FuncRs->second;
173173
SmallString<256> Data;
174174
raw_svector_ostream OS(Data);
175175

llvm/lib/Target/DirectX/DXILRootSignature.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ analyzeModule(Module &M) {
132132
// Function was pruned during compilation.
133133
const MDOperand &FunctionPointerMdNode = RSDefNode->getOperand(0);
134134
if (FunctionPointerMdNode == nullptr) {
135+
reportError(
136+
Ctx, "Function associated with Root Signature definition is null.");
135137
continue;
136138
}
137139

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; RUN: not opt -passes='print<dxil-root-signature>' %s -S -o - 2>&1 | FileCheck %s
2+
3+
; CHECK: error: Function associated with Root Signature definition is null
4+
; CHECK-NOT: Root Signature Definitions
5+
6+
target triple = "dxil-unknown-shadermodel6.0-compute"
7+
8+
define void @main() #0 {
9+
entry:
10+
ret void
11+
}
12+
13+
attributes #0 = { "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" }
14+
15+
!dx.rootsignatures = !{!2, !5} ; list of function/root signature pairs
16+
!2 = !{ ptr @main, !3 } ; function, root signature
17+
!3 = !{ !4 } ; list of root signature elements
18+
!4 = !{ !"RootFlags", i32 1 } ; 1 = allow_input_assembler_input_layout
19+
!5 = !{ null, !6 } ; function, root signature
20+
!6 = !{ !7 } ; list of root signature elements
21+
!7 = !{ !"RootFlags", i32 2 } ; 1 = allow_input_assembler_input_layout

0 commit comments

Comments
 (0)