summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/LTO/LTO.cpp4
-rw-r--r--llvm/test/ThinLTO/X86/weak_resolution_single.ll9
2 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 094b0c6b31a..11bfc94082e 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -92,10 +92,6 @@ void thinLTOResolveWeakForLinkerInIndex(
function_ref<bool(StringRef, GlobalValue::GUID)> isExported,
function_ref<void(StringRef, GlobalValue::GUID, GlobalValue::LinkageTypes)>
recordNewLinkage) {
- if (Index.modulePaths().size() == 1)
- // Nothing to do if we don't have multiple modules
- return;
-
// We won't optimize the globals that are referenced by an alias for now
// Ideally we should turn the alias into a global and duplicate the definition
// when needed.
diff --git a/llvm/test/ThinLTO/X86/weak_resolution_single.ll b/llvm/test/ThinLTO/X86/weak_resolution_single.ll
new file mode 100644
index 00000000000..79bf5f39322
--- /dev/null
+++ b/llvm/test/ThinLTO/X86/weak_resolution_single.ll
@@ -0,0 +1,9 @@
+; RUN: opt -module-summary %s -o %t.bc
+; RUN: llvm-lto -thinlto-action=thinlink -o %t2.bc %t.bc
+
+; RUN: llvm-lto -thinlto-action=promote %t.bc -thinlto-index=%t2.bc -exported-symbol=foo -o - | llvm-lto -thinlto-action=internalize -thinlto-module-id=%t.bc - -thinlto-index=%t2.bc -exported-symbol=foo -o - | llvm-dis -o - | FileCheck %s
+
+; CHECK: define weak_odr void @foo()
+define linkonce_odr void @foo() {
+ ret void
+}
OpenPOWER on IntegriCloud