]> granicus.if.org Git - llvm/commitdiff
[ExecutionEngine] After a heroic dev-meeting hack session, the JIT supports TLS.
authorLang Hames <lhames@gmail.com>
Fri, 20 Oct 2017 00:53:16 +0000 (00:53 +0000)
committerLang Hames <lhames@gmail.com>
Fri, 20 Oct 2017 00:53:16 +0000 (00:53 +0000)
Turns on EmulatedTLS support by default in EngineBuilder. ;)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316200 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ExecutionEngine/ExecutionEngine.h
lib/ExecutionEngine/TargetSelect.cpp
test/ExecutionEngine/MCJIT/tlvtest.ll [new file with mode: 0644]
test/ExecutionEngine/OrcMCJIT/tlvtest.ll [new file with mode: 0644]

index 70ee843095f281e6edd225d688f653744bdc5b15..77c23b46d320130644f0dfb669b36b0be410b07d 100644 (file)
@@ -541,6 +541,7 @@ private:
   SmallVector<std::string, 4> MAttrs;
   bool VerifyModules;
   bool UseOrcMCJITReplacement;
+  bool EmulatedTLS = true;
 
 public:
   /// Default constructor for EngineBuilder.
@@ -641,6 +642,10 @@ public:
     this->UseOrcMCJITReplacement = UseOrcMCJITReplacement;
   }
 
+  void setEmulatedTLS(bool EmulatedTLS) {
+    this->EmulatedTLS = EmulatedTLS;
+  }
+  
   TargetMachine *selectTarget();
 
   /// selectTarget - Pick a target either via -march or by guessing the native
index 5df5e1eabec3745eb0c9d0b05e2280ddabf13bc7..18dfa4e3c319c0ee524d89275423178b0512ee94 100644 (file)
@@ -95,7 +95,8 @@ TargetMachine *EngineBuilder::selectTarget(const Triple &TargetTriple,
   TargetMachine *Target =
       TheTarget->createTargetMachine(TheTriple.getTriple(), MCPU, FeaturesStr,
                                      Options, RelocModel, CMModel, OptLevel,
-                                     /*JIT*/ true);
+                                    /*JIT*/ true);
+  Target->Options.EmulatedTLS = EmulatedTLS;
   assert(Target && "Could not allocate target machine!");
   return Target;
 }
diff --git a/test/ExecutionEngine/MCJIT/tlvtest.ll b/test/ExecutionEngine/MCJIT/tlvtest.ll
new file mode 100644 (file)
index 0000000..2596dab
--- /dev/null
@@ -0,0 +1,10 @@
+; RUN: %lli %s > /dev/null
+
+@x = thread_local local_unnamed_addr global i32 0
+
+define i32 @main() {
+entry:
+  store i32 42, i32* @x
+  ret i32 0
+}
+
diff --git a/test/ExecutionEngine/OrcMCJIT/tlvtest.ll b/test/ExecutionEngine/OrcMCJIT/tlvtest.ll
new file mode 100644 (file)
index 0000000..2596dab
--- /dev/null
@@ -0,0 +1,10 @@
+; RUN: %lli %s > /dev/null
+
+@x = thread_local local_unnamed_addr global i32 0
+
+define i32 @main() {
+entry:
+  store i32 42, i32* @x
+  ret i32 0
+}
+