From b65c3ed0d9d1d466067fe9fb24381fb641de6e58 Mon Sep 17 00:00:00 2001 From: Nick Sarnie Date: Wed, 18 Sep 2024 23:04:56 +0900 Subject: [PATCH] [SYCL] Add sanity checks for spec constant metadata (#15420) Follow up from https://github.com/intel/llvm/pull/15346. Signed-off-by: Sarnie, Nick --- llvm/lib/SYCLLowerIR/ComputeModuleRuntimeInfo.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/llvm/lib/SYCLLowerIR/ComputeModuleRuntimeInfo.cpp b/llvm/lib/SYCLLowerIR/ComputeModuleRuntimeInfo.cpp index 0bfcd53784af3..5f7678313087d 100644 --- a/llvm/lib/SYCLLowerIR/ComputeModuleRuntimeInfo.cpp +++ b/llvm/lib/SYCLLowerIR/ComputeModuleRuntimeInfo.cpp @@ -161,8 +161,18 @@ PropSetRegTy computeModuleProperties(const Module &M, std::vector DefaultValues; SpecConstantsPass::collectSpecConstantDefaultValuesMetadata(M, DefaultValues); + assert(!DefaultValues.empty() && + "Expected metadata for spec constant defaults."); PropSet.add(PropSetRegTy::SYCL_SPEC_CONSTANTS_DEFAULT_VALUES, "all", DefaultValues); + } else { +#ifndef NDEBUG + std::vector DefaultValues; + SpecConstantsPass::collectSpecConstantDefaultValuesMetadata(M, + DefaultValues); + assert(DefaultValues.empty() && + "Unexpected metadata for spec constant defaults."); +#endif } if (GlobProps.EmitKernelParamInfo) { // extract kernel parameter optimization info per module