Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert db7696e and 4a88836 (#427) #449

Merged
merged 1 commit into from
Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions common_clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static volatile bool lazyCCInit =
true; // the flag must be 'volatile' to prevent caching in a CPU register
static llvm::sys::Mutex lazyCCInitMutex;

static llvm::ManagedStatic<llvm::sys::SmartMutex<true> > compileMutex;
llvm::ManagedStatic<llvm::sys::SmartMutex<true>> compileMutex;

void CommonClangTerminate() { llvm::llvm_shutdown(); }

Expand Down Expand Up @@ -212,6 +212,7 @@ Compile(const char *pszProgramSource, const char **pInputHeaders,
CommonClangInitialize();

try {
llvm::sys::SmartScopedLock<true> compileGuard{*compileMutex};
std::unique_ptr<OCLFEBinaryResult> pResult(new OCLFEBinaryResult());

// Create the clang compiler
Expand All @@ -223,8 +224,6 @@ Compile(const char *pszProgramSource, const char **pInputHeaders,
// Prepare error log
llvm::raw_string_ostream err_ostream(pResult->getLogRef());
{
llvm::sys::SmartScopedLock<true> compileGuard {*compileMutex};

// Parse options
optionsParser.processOptions(pszOptions, pszOptionsEx);

Expand Down Expand Up @@ -343,7 +342,6 @@ Compile(const char *pszProgramSource, const char **pInputHeaders,
err_ostream.flush();
}
{
llvm::sys::SmartScopedLock<true> compileGuard {*compileMutex};
if (pBinaryResult) {
*pBinaryResult = pResult.release();
}
Expand Down
4 changes: 2 additions & 2 deletions options_compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Copyright (c) Intel Corporation (2009-2017).

using namespace llvm::opt;

static llvm::ManagedStatic<llvm::sys::SmartMutex<true> > compileOptionsMutex;
extern llvm::ManagedStatic<llvm::sys::SmartMutex<true>> compileMutex;

static const OptTable::Info ClangOptionsInfoTable[] = {
#define PREFIX(NAME, VALUE)
Expand Down Expand Up @@ -430,7 +430,7 @@ extern "C" CC_DLL_EXPORT bool CheckCompileOptions(const char *pszOptions,
size_t uiUnknownOptionsSize) {
// LLVM doesn't guarantee thread safety,
// therefore we serialize execution of LLVM code.
llvm::sys::SmartScopedLock<true> compileOptionsGuard {*compileOptionsMutex};
llvm::sys::SmartScopedLock<true> compileOptionsGuard{*compileMutex};

try {
CompileOptionsParser optionsParser("200");
Expand Down