diff --git a/llvm/include/llvm/SYCLPostLink/ModuleSplitter.h b/llvm/include/llvm/SYCLPostLink/ModuleSplitter.h index 3a0d837ba600f..8ad837beb7da5 100644 --- a/llvm/include/llvm/SYCLPostLink/ModuleSplitter.h +++ b/llvm/include/llvm/SYCLPostLink/ModuleSplitter.h @@ -33,11 +33,11 @@ class Function; namespace cl { class OptionCategory; -} +} // namespace cl namespace module_split { -constexpr char SYCL_ESIMD_SPLIT_MD_NAME[] = "sycl-esimd-split-status"; +constexpr char SyclEsimdSplitMdName[] = "sycl-esimd-split-status"; constexpr std::array SYCLDeviceLibs = { "libsycl-fallback-bfloat16.bc", "libsycl-native-bfloat16.bc"}; @@ -144,7 +144,7 @@ class ModuleDesc { : M(std::move(M)), IsTopLevel(true), Name(Name) { // DeviceLib module doesn't include any entry point,it can be constructed // using ctor without any entry point related parameter. - for (auto Fn : SYCLDeviceLibs) { + for (const auto *Fn : SYCLDeviceLibs) { if (StringRef(Fn) == Name) { IsSYCLDeviceLib = true; break; diff --git a/llvm/lib/SYCLPostLink/ComputeModuleRuntimeInfo.cpp b/llvm/lib/SYCLPostLink/ComputeModuleRuntimeInfo.cpp index 8e34d3bcb281f..39548ab2db82d 100644 --- a/llvm/lib/SYCLPostLink/ComputeModuleRuntimeInfo.cpp +++ b/llvm/lib/SYCLPostLink/ComputeModuleRuntimeInfo.cpp @@ -11,7 +11,6 @@ #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringSet.h" -#include "llvm/Demangle/Demangle.h" #include "llvm/IR/PassInstrumentation.h" #include "llvm/SYCLLowerIR/CompileTimePropertiesPass.h" #include "llvm/SYCLLowerIR/DeviceGlobals.h" @@ -32,7 +31,7 @@ namespace llvm::sycl { namespace { module_split::SyclEsimdSplitStatus getSYCLESIMDSplitStatusFromMetadata(const Module &M) { - auto *SplitMD = M.getNamedMetadata(module_split::SYCL_ESIMD_SPLIT_MD_NAME); + auto *SplitMD = M.getNamedMetadata(module_split::SyclEsimdSplitMdName); assert(SplitMD && "Unexpected metadata"); auto *MDOp = SplitMD->getOperand(0); assert(MDOp && "Unexpected metadata operand"); @@ -67,7 +66,7 @@ bool isModuleUsingTsan(const Module &M) { // Optional. // Otherwise, it returns an Optional containing a list of reached // SPIR kernel function's names. -std::optional> +static std::optional> traverseCGToFindSPIRKernels(const Function *StartingFunction) { std::queue FunctionsToVisit; std::unordered_set VisitedFunctions; @@ -106,7 +105,8 @@ traverseCGToFindSPIRKernels(const Function *StartingFunction) { return {std::move(KernelNames)}; } -std::vector getKernelNamesUsingAssert(const Module &M) { + +static std::vector getKernelNamesUsingAssert(const Module &M) { auto *DevicelibAssertFailFunction = M.getFunction("__devicelib_assert_fail"); if (!DevicelibAssertFailFunction) return {}; @@ -131,8 +131,8 @@ std::vector getKernelNamesUsingAssert(const Module &M) { // Gets 1- to 3-dimension work-group related information for function Func. // Returns an empty vector if not present. template -std::vector getKernelWorkGroupMetadata(const Function &Func, - const char *MDName) { +static std::vector getKernelWorkGroupMetadata(const Function &Func, + const char *MDName) { MDNode *WorkGroupMD = Func.getMetadata(MDName); if (!WorkGroupMD) return {}; @@ -149,8 +149,8 @@ std::vector getKernelWorkGroupMetadata(const Function &Func, // Gets a single-dimensional piece of information for function Func. // Returns std::nullopt if metadata is not present. template -std::optional getKernelSingleEltMetadata(const Function &Func, - const char *MDName) { +static std::optional getKernelSingleEltMetadata(const Function &Func, + const char *MDName) { if (MDNode *MaxDimMD = Func.getMetadata(MDName)) { assert(MaxDimMD->getNumOperands() == 1 && "Malformed node."); return mdconst::extract(MaxDimMD->getOperand(0)) @@ -543,6 +543,7 @@ PropSetRegTy computeModuleProperties(const Module &M, return PropSet; } + std::string computeModuleSymbolTable(const Module &M, const EntryPointSet &EntryPoints) { diff --git a/llvm/lib/SYCLPostLink/ModuleSplitter.cpp b/llvm/lib/SYCLPostLink/ModuleSplitter.cpp index 6364c1c9933e0..24112fab71c16 100644 --- a/llvm/lib/SYCLPostLink/ModuleSplitter.cpp +++ b/llvm/lib/SYCLPostLink/ModuleSplitter.cpp @@ -861,7 +861,7 @@ void ModuleDesc::dump() const { void ModuleDesc::saveSplitInformationAsMetadata() { // Add metadata to the module so we can identify what kind of SYCL/ESIMD split // later. - auto *SplitMD = M->getOrInsertNamedMetadata(SYCL_ESIMD_SPLIT_MD_NAME); + auto *SplitMD = M->getOrInsertNamedMetadata(SyclEsimdSplitMdName); auto *SplitMDOp = MDNode::get( M->getContext(), ConstantAsMetadata::get(ConstantInt::get( Type::getInt8Ty(M->getContext()),