summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/CodeGen/Analysis.cpp5
-rw-r--r--llvm/test/LTO/X86/pr25919.ll11
2 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/Analysis.cpp b/llvm/lib/CodeGen/Analysis.cpp
index 75579a2b455..97b692fbe56 100644
--- a/llvm/lib/CodeGen/Analysis.cpp
+++ b/llvm/lib/CodeGen/Analysis.cpp
@@ -639,6 +639,11 @@ bool llvm::canBeOmittedFromSymbolTable(const GlobalValue *GV) {
if (isa<GlobalAlias>(GV))
return false;
+ // If we don't see every use, we have to be conservative and assume the value
+ // address is significant.
+ if (GV->getParent()->getMaterializer())
+ return false;
+
GlobalStatus GS;
if (GlobalStatus::analyzeGlobal(GV, GS))
return false;
diff --git a/llvm/test/LTO/X86/pr25919.ll b/llvm/test/LTO/X86/pr25919.ll
new file mode 100644
index 00000000000..b7fe0c636a1
--- /dev/null
+++ b/llvm/test/LTO/X86/pr25919.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s >%t1
+; RUN: llvm-lto -list-symbols-only %t1 | FileCheck %s
+
+; This tests that we don't crash trying to find all uses in a lazily loaded
+; module.
+; CHECK: foo
+
+target triple = "x86_64-unknown-linux-gnu"
+define linkonce_odr void @foo() {
+ ret void
+}
OpenPOWER on IntegriCloud