Skip to content

Commit 3d19f8b

Browse files
author
joaosaffran
committed
stopping compilation if root signature error were emitted
1 parent ae3d03f commit 3d19f8b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

llvm/lib/Target/DirectX/DXILRootSignature.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "llvm/InitializePasses.h"
2626
#include "llvm/Pass.h"
2727
#include "llvm/Support/Error.h"
28+
#include "llvm/Support/ErrorHandling.h"
2829
#include <optional>
2930

3031
using namespace llvm;
@@ -152,6 +153,8 @@ static const Function *getEntryFunction(Module &M, ModuleMetadataInfo MMI) {
152153
LLVMContext *Ctx = &M.getContext();
153154
if (MMI.EntryPropertyVec.size() != 1) {
154155
reportError(Ctx, "More than one entry function defined.");
156+
// needed to stop compilation
157+
report_fatal_error("Invalid Root Signature Definition", false);
155158
return nullptr;
156159
}
157160
return MMI.EntryPropertyVec[0].Entry;
@@ -165,10 +168,15 @@ ModuleRootSignature::analyzeModule(Module &M, const Function *F) {
165168
ModuleRootSignature MRS;
166169

167170
NamedMDNode *RootSignatureNode = M.getNamedMetadata("dx.rootsignatures");
168-
if (RootSignatureNode == nullptr || parse(Ctx, &MRS, RootSignatureNode, F) ||
169-
validate(Ctx, &MRS))
171+
if (RootSignatureNode == nullptr)
170172
return std::nullopt;
171173

174+
if (parse(Ctx, &MRS, RootSignatureNode, F) || validate(Ctx, &MRS)) {
175+
// needed to stop compilation
176+
report_fatal_error("Invalid Root Signature Definition", false);
177+
return std::nullopt;
178+
}
179+
172180
return MRS;
173181
}
174182

0 commit comments

Comments
 (0)