[Orc] Fix local-linkage handling in the CompileOnDemand layer.
authorLang Hames <lhames@gmail.com>
Thu, 2 Apr 2015 05:28:10 +0000 (05:28 +0000)
committerLang Hames <lhames@gmail.com>
Thu, 2 Apr 2015 05:28:10 +0000 (05:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233895 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/Orc/IndirectionUtils.cpp
test/ExecutionEngine/OrcLazy/private_linkage.ll [new file with mode: 0644]

index 8cf490f34cb3a46bf63d421b7db1a8e5baa74c76..74766450e8c416633b7b0ecac1501ee253dd8897 100644 (file)
@@ -54,7 +54,7 @@ void partition(Module &M, const ModulePartitionMap &PMap) {
         if (KVPair.second.count(&Orig)) {
           copyGVInitializer(New, Orig, VMap);
         }
-        if (New.getLinkage() == GlobalValue::PrivateLinkage) {
+        if (New.hasLocalLinkage()) {
           New.setLinkage(GlobalValue::ExternalLinkage);
           New.setVisibility(GlobalValue::HiddenVisibility);
         }
@@ -64,7 +64,7 @@ void partition(Module &M, const ModulePartitionMap &PMap) {
       [&](Function &New, const Function &Orig, ValueToValueMapTy &VMap) {
         if (KVPair.second.count(&Orig))
           copyFunctionBody(New, Orig, VMap);
-        if (New.getLinkage() == GlobalValue::InternalLinkage) {
+        if (New.hasLocalLinkage()) {
           New.setLinkage(GlobalValue::ExternalLinkage);
           New.setVisibility(GlobalValue::HiddenVisibility);
         }
diff --git a/test/ExecutionEngine/OrcLazy/private_linkage.ll b/test/ExecutionEngine/OrcLazy/private_linkage.ll
new file mode 100644 (file)
index 0000000..11813dd
--- /dev/null
@@ -0,0 +1,12 @@
+; RUN: lli -jit-kind=orc-lazy %s
+
+define private void @_ZL3foov() {
+entry:
+  ret void
+}
+
+define i32 @main(i32 %argc, i8** nocapture readnone %argv) {
+entry:
+  tail call void @_ZL3foov()
+  ret i32 0
+}