]> granicus.if.org Git - llvm/commitdiff
Merging r257915:
authorTom Stellard <thomas.stellard@amd.com>
Wed, 18 May 2016 20:32:40 +0000 (20:32 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Wed, 18 May 2016 20:32:40 +0000 (20:32 +0000)
------------------------------------------------------------------------
r257915 | rafael.espindola | 2016-01-15 10:23:46 -0800 (Fri, 15 Jan 2016) | 9 lines

Don't try to check all uses if lazy loading.

This means that LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN will not be set
in a few cases.

This should have no impact in ld64 since it doesn't use lazy loading
when merging modules and that is when it checks
LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN.

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_38@269978 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/Analysis.cpp
test/LTO/X86/pr25919.ll [new file with mode: 0644]

index 75579a2b45595c6174d985e8dd2faa5578a98f56..97b692fbe56e7168520732094c1edec949be20c0 100644 (file)
@@ -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/test/LTO/X86/pr25919.ll b/test/LTO/X86/pr25919.ll
new file mode 100644 (file)
index 0000000..b7fe0c6
--- /dev/null
@@ -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
+}