Skip to content

Commit b65c3ed

Browse files
authored
[SYCL] Add sanity checks for spec constant metadata (#15420)
Follow up from #15346. Signed-off-by: Sarnie, Nick <[email protected]>
1 parent 9e39902 commit b65c3ed

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

llvm/lib/SYCLLowerIR/ComputeModuleRuntimeInfo.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,18 @@ PropSetRegTy computeModuleProperties(const Module &M,
161161
std::vector<char> DefaultValues;
162162
SpecConstantsPass::collectSpecConstantDefaultValuesMetadata(M,
163163
DefaultValues);
164+
assert(!DefaultValues.empty() &&
165+
"Expected metadata for spec constant defaults.");
164166
PropSet.add(PropSetRegTy::SYCL_SPEC_CONSTANTS_DEFAULT_VALUES, "all",
165167
DefaultValues);
168+
} else {
169+
#ifndef NDEBUG
170+
std::vector<char> DefaultValues;
171+
SpecConstantsPass::collectSpecConstantDefaultValuesMetadata(M,
172+
DefaultValues);
173+
assert(DefaultValues.empty() &&
174+
"Unexpected metadata for spec constant defaults.");
175+
#endif
166176
}
167177
if (GlobProps.EmitKernelParamInfo) {
168178
// extract kernel parameter optimization info per module

0 commit comments

Comments
 (0)