11
11
#include " llvm/ADT/SmallString.h"
12
12
#include " llvm/ADT/SmallVector.h"
13
13
#include " llvm/ADT/StringSet.h"
14
- #include " llvm/Demangle/Demangle.h"
15
14
#include " llvm/IR/PassInstrumentation.h"
16
15
#include " llvm/SYCLLowerIR/CompileTimePropertiesPass.h"
17
16
#include " llvm/SYCLLowerIR/DeviceGlobals.h"
@@ -32,7 +31,7 @@ namespace llvm::sycl {
32
31
namespace {
33
32
module_split::SyclEsimdSplitStatus
34
33
getSYCLESIMDSplitStatusFromMetadata (const Module &M) {
35
- auto *SplitMD = M.getNamedMetadata (module_split::SYCL_ESIMD_SPLIT_MD_NAME );
34
+ auto *SplitMD = M.getNamedMetadata (module_split::SyclEsimdSplitMdName );
36
35
assert (SplitMD && " Unexpected metadata" );
37
36
auto *MDOp = SplitMD->getOperand (0 );
38
37
assert (MDOp && " Unexpected metadata operand" );
@@ -67,7 +66,7 @@ bool isModuleUsingTsan(const Module &M) {
67
66
// Optional.
68
67
// Otherwise, it returns an Optional containing a list of reached
69
68
// SPIR kernel function's names.
70
- std::optional<std::vector<StringRef>>
69
+ static std::optional<std::vector<StringRef>>
71
70
traverseCGToFindSPIRKernels (const Function *StartingFunction) {
72
71
std::queue<const Function *> FunctionsToVisit;
73
72
std::unordered_set<const Function *> VisitedFunctions;
@@ -106,7 +105,8 @@ traverseCGToFindSPIRKernels(const Function *StartingFunction) {
106
105
107
106
return {std::move (KernelNames)};
108
107
}
109
- std::vector<StringRef> getKernelNamesUsingAssert (const Module &M) {
108
+
109
+ static std::vector<StringRef> getKernelNamesUsingAssert (const Module &M) {
110
110
auto *DevicelibAssertFailFunction = M.getFunction (" __devicelib_assert_fail" );
111
111
if (!DevicelibAssertFailFunction)
112
112
return {};
@@ -131,8 +131,8 @@ std::vector<StringRef> getKernelNamesUsingAssert(const Module &M) {
131
131
// Gets 1- to 3-dimension work-group related information for function Func.
132
132
// Returns an empty vector if not present.
133
133
template <typename T>
134
- std::vector<T> getKernelWorkGroupMetadata (const Function &Func,
135
- const char *MDName) {
134
+ static std::vector<T> getKernelWorkGroupMetadata (const Function &Func,
135
+ const char *MDName) {
136
136
MDNode *WorkGroupMD = Func.getMetadata (MDName);
137
137
if (!WorkGroupMD)
138
138
return {};
@@ -149,8 +149,8 @@ std::vector<T> getKernelWorkGroupMetadata(const Function &Func,
149
149
// Gets a single-dimensional piece of information for function Func.
150
150
// Returns std::nullopt if metadata is not present.
151
151
template <typename T>
152
- std::optional<T> getKernelSingleEltMetadata (const Function &Func,
153
- const char *MDName) {
152
+ static std::optional<T> getKernelSingleEltMetadata (const Function &Func,
153
+ const char *MDName) {
154
154
if (MDNode *MaxDimMD = Func.getMetadata (MDName)) {
155
155
assert (MaxDimMD->getNumOperands () == 1 && " Malformed node." );
156
156
return mdconst::extract<ConstantInt>(MaxDimMD->getOperand (0 ))
@@ -543,6 +543,7 @@ PropSetRegTy computeModuleProperties(const Module &M,
543
543
544
544
return PropSet;
545
545
}
546
+
546
547
std::string computeModuleSymbolTable (const Module &M,
547
548
const EntryPointSet &EntryPoints) {
548
549
0 commit comments