updating error messages and tests

This commit is contained in:
Joao Saffran 2025-08-21 13:37:13 -07:00
parent 15b7592062
commit 11b9fb21bf
6 changed files with 11 additions and 9 deletions

View File

@ -36,8 +36,11 @@ BindingInfo::BindingSpaces::getOrInsertSpace(uint32_t Space) {
std::optional<const BindingInfo::RegisterSpace *>
BindingInfo::BindingSpaces::contains(uint32_t Space) const {
const BindingInfo::RegisterSpace *It =
std::find(Spaces.begin(), Spaces.end(), Space);
const BindingInfo::RegisterSpace *It = Spaces.begin();
for (auto *End = Spaces.end(); It != End; ++It) {
if (It->Space == Space)
break;
}
if (It == Spaces.end())
return std::nullopt;
return It;

View File

@ -138,9 +138,8 @@ reportRegNotBound(Module &M, ResourceClass Class,
const llvm::dxil::ResourceInfo::ResourceBinding &Unbound) {
SmallString<128> Message;
raw_svector_ostream OS(Message);
OS << "register " << getResourceClassName(Class)
<< " (space=" << Unbound.Space << ", register=" << Unbound.LowerBound
<< ")"
OS << getResourceClassName(Class) << " register " << Unbound.LowerBound
<< " in space " << Unbound.Space
<< " does not have a binding in the Root Signature";
M.getContext().diagnose(DiagnosticInfoGeneric(Message));
}

View File

@ -1,5 +1,5 @@
; RUN: not opt -S -passes='dxil-post-optimization-validation' -mtriple=dxil-pc-shadermodel6.6-compute %s 2>&1 | FileCheck %s
; CHECK: error: register CBV (space=666, register=2) does not have a binding in the Root Signature
; CHECK: error: CBV register 2 in space 666 does not have a binding in the Root Signature
%__cblayout_CB = type <{ float }>

View File

@ -1,5 +1,5 @@
; RUN: not opt -S -passes='dxil-post-optimization-validation' -mtriple=dxil-pc-shadermodel6.6-compute %s 2>&1 | FileCheck %s
; CHECK: error: register Sampler (space=2, register=3) does not have a binding in the Root Signature
; CHECK: error: Sampler register 3 in space 2 does not have a binding in the Root Signature
@Smp.str = private unnamed_addr constant [4 x i8] c"Smp\00", align 1

View File

@ -1,5 +1,5 @@
; RUN: not opt -S -passes='dxil-post-optimization-validation' -mtriple=dxil-pc-shadermodel6.6-compute %s 2>&1 | FileCheck %s
; CHECK: error: register SRV (space=0, register=0) does not have a binding in the Root Signature
; CHECK: error: SRV register 0 in space 0 does not have a binding in the Root Signature
@SB.str = private unnamed_addr constant [3 x i8] c"SB\00", align 1

View File

@ -1,5 +1,5 @@
; RUN: not opt -S -passes='dxil-post-optimization-validation' -mtriple=dxil-pc-shadermodel6.6-compute %s 2>&1 | FileCheck %s
; CHECK: error: register UAV (space=0, register=4294967294) does not have a binding in the Root Signature
; CHECK: error: UAV register 4294967294 in space 0 does not have a binding in the Root Signature
@RWB.str = private unnamed_addr constant [4 x i8] c"RWB\00", align 1