diff --git a/llvm/lib/SYCLPostLink/ComputeModuleRuntimeInfo.cpp b/llvm/lib/SYCLPostLink/ComputeModuleRuntimeInfo.cpp index f08bf1a848604..f69fad9573aa4 100644 --- a/llvm/lib/SYCLPostLink/ComputeModuleRuntimeInfo.cpp +++ b/llvm/lib/SYCLPostLink/ComputeModuleRuntimeInfo.cpp @@ -248,11 +248,13 @@ PropSetRegTy computeModuleProperties(const Module &M, if (!GV.hasExternalLinkage()) continue; + auto *ST = dyn_cast(GV.getValueType()); + if (!ST || ST->isLiteral()) // Literal structs don't have names. + continue; + // Check if it's a device_global by type name (declarations don't have // attributes). - std::string TypeName; - raw_string_ostream(TypeName) << *GV.getValueType(); - + StringRef TypeName = ST->getStructName(); if (TypeName.find("device_global") == std::string::npos) continue;