Skip to content

Commit 1a321de

Browse files
LU-JOHNsys-ce-bb
authored andcommitted
Make assertion precise (#2596)
Make code clearer and check for exact number of operands. Signed-off-by: Lu, John <[email protected]> Original commit: KhronosGroup/SPIRV-LLVM-Translator@cd4eaf69744a413
1 parent d0f0838 commit 1a321de

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm-spirv/lib/SPIRV/SPIRVToLLVMDbgTran.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,13 +1229,13 @@ DINode *SPIRVToLLVMDbgTran::transTypeInheritance(const SPIRVExtInst *DebugInst,
12291229
OffsetIdx = NonSemantic::OffsetIdx;
12301230
FlagsIdx = NonSemantic::FlagsIdx;
12311231
} else {
1232-
OperandCount = NonSemantic::OperandCount;
1232+
OperandCount = OpenCL::OperandCount;
12331233
ParentIdx = OpenCL::ParentIdx;
12341234
OffsetIdx = OpenCL::OffsetIdx;
12351235
FlagsIdx = OpenCL::FlagsIdx;
12361236
}
12371237
const SPIRVWordVec &Ops = DebugInst->getArguments();
1238-
assert(Ops.size() >= OperandCount && "Invalid number of operands");
1238+
assert(Ops.size() == OperandCount && "Invalid number of operands");
12391239
DIType *Parent =
12401240
transDebugInst<DIType>(BM->get<SPIRVExtInst>(Ops[ParentIdx]));
12411241
DINode::DIFlags Flags = DINode::FlagZero;

0 commit comments

Comments
 (0)