summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-10-21 17:14:55 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-10-21 17:14:55 +0000
commit713cab059ebb67c2f51d8da9d8e57be2b1dcd9c2 (patch)
treec92ff5eac147f406e87b6e2cb43543d6e5b37f11 /test
parentda39dd30ad3c969be3ac843307d4630807699538 (diff)
downloadllvm-713cab059ebb67c2f51d8da9d8e57be2b1dcd9c2.tar.gz
llvm-713cab059ebb67c2f51d8da9d8e57be2b1dcd9c2.tar.bz2
llvm-713cab059ebb67c2f51d8da9d8e57be2b1dcd9c2.tar.xz
Optimize more linkonce_odr values during LTO.
When a linkonce_odr value that is on the dso list is not unnamed_addr we can still look to see if anything is actually using its address. If not, it is safe to hide it. This patch implements that by moving GlobalStatus to Transforms/Utils and using it in Internalize. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193090 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/LTO/cfi_endproc.ll3
-rw-r--r--test/Transforms/Internalize/lists.ll12
2 files changed, 12 insertions, 3 deletions
diff --git a/test/LTO/cfi_endproc.ll b/test/LTO/cfi_endproc.ll
index d8818d226e..a5cc649fc8 100644
--- a/test/LTO/cfi_endproc.ll
+++ b/test/LTO/cfi_endproc.ll
@@ -29,6 +29,9 @@ define i32 @main(i32 %argc, i8** %argv) {
; RUN: llvm-nm %t | FileCheck %s -check-prefix=ZED1_AND_ZED2
; ZED1_AND_ZED2: V zed1
@zed1 = linkonce_odr global i32 42
+define i32* @get_zed1() {
+ ret i32* @zed1
+}
; ZED1_AND_ZED2: d zed2
@zed2 = linkonce_odr unnamed_addr global i32 42
diff --git a/test/Transforms/Internalize/lists.ll b/test/Transforms/Internalize/lists.ll
index 59fe0737d3..3ebf0edf82 100644
--- a/test/Transforms/Internalize/lists.ll
+++ b/test/Transforms/Internalize/lists.ll
@@ -15,7 +15,7 @@
; Put zed1 and zed2 in the symbol table. If the address is not relevant, we
; internalize them.
-; RUN: opt < %s -internalize -internalize-dso-list zed1,zed2 -S | FileCheck --check-prefix=ZED1_AND_ZED2 %s
+; RUN: opt < %s -internalize -internalize-dso-list zed1,zed2,zed3 -S | FileCheck --check-prefix=ZEDS %s
; ALL: @i = internal global
; FOO_AND_J: @i = internal global
@@ -29,12 +29,18 @@
; FOO_J_AND_BAR: @j = global
@j = global i32 0
-; ZED1_AND_ZED2: @zed1 = linkonce_odr global i32 42
+; ZEDS: @zed1 = internal global i32 42
@zed1 = linkonce_odr global i32 42
-; ZED1_AND_ZED2: @zed2 = internal unnamed_addr global i32 42
+; ZEDS: @zed2 = internal unnamed_addr global i32 42
@zed2 = linkonce_odr unnamed_addr global i32 42
+; ZEDS: @zed3 = linkonce_odr global i32 42
+@zed3 = linkonce_odr global i32 42
+define i32* @get_zed3() {
+ ret i32* @zed3
+}
+
; ALL: define internal void @main() {
; FOO_AND_J: define internal void @main() {
; FOO_AND_BAR: define internal void @main() {