aboutsummaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/JIT/JIT.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ExecutionEngine/JIT/JIT.cpp')
-rw-r--r--lib/ExecutionEngine/JIT/JIT.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp
index 6940d85d75..0f98ddcabb 100644
--- a/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/lib/ExecutionEngine/JIT/JIT.cpp
@@ -553,6 +553,8 @@ void *JIT::getPointerToFunction(Function *F) {
if (void *Addr = getPointerToGlobalIfAvailable(F))
return Addr; // Check if function already code gen'd
+ MutexGuard locked(lock);
+
// Make sure we read in the function if it exists in this Module.
if (F->hasNotBeenReadFromBitcode()) {
// Determine the module provider this function is provided by.
@@ -578,8 +580,6 @@ void *JIT::getPointerToFunction(Function *F) {
return Addr;
}
- MutexGuard locked(lock);
-
if (F->isDeclaration()) {
bool AbortOnFailure = F->getLinkage() != GlobalValue::ExternalWeakLinkage;
void *Addr = getPointerToNamedFunction(F->getName(), AbortOnFailure);