diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-10-21 17:14:55 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-10-21 17:14:55 +0000 |
| commit | 3d7fc25c7c08d25b97c56ab99aee1a8551c2155d (patch) | |
| tree | 004ba3e61bf61d3fd7e7ade3ba671b98f0a4f5e5 /llvm/test | |
| parent | 63bb3e1182f79f52d15cbf658545515f6bcece7b (diff) | |
| download | bcm5719-llvm-3d7fc25c7c08d25b97c56ab99aee1a8551c2155d.tar.gz bcm5719-llvm-3d7fc25c7c08d25b97c56ab99aee1a8551c2155d.zip | |
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.
llvm-svn: 193090
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/LTO/cfi_endproc.ll | 3 | ||||
| -rw-r--r-- | llvm/test/Transforms/Internalize/lists.ll | 12 |
2 files changed, 12 insertions, 3 deletions
diff --git a/llvm/test/LTO/cfi_endproc.ll b/llvm/test/LTO/cfi_endproc.ll index d8818d226e0..a5cc649fc86 100644 --- a/llvm/test/LTO/cfi_endproc.ll +++ b/llvm/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/llvm/test/Transforms/Internalize/lists.ll b/llvm/test/Transforms/Internalize/lists.ll index 59fe0737d3e..3ebf0edf820 100644 --- a/llvm/test/Transforms/Internalize/lists.ll +++ b/llvm/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() { |

