diff options
| author | Mehdi Amini <mehdi.amini@apple.com> | 2015-12-08 19:01:29 +0000 |
|---|---|---|
| committer | Mehdi Amini <mehdi.amini@apple.com> | 2015-12-08 19:01:29 +0000 |
| commit | 37c25fa1d15d2c1fd888b3e77c1928547e7542d1 (patch) | |
| tree | 208e8655b476c58b46c2604bdbdc8113776a8a6c /llvm/test/Transforms/GlobalOpt | |
| parent | 5f02b777c6c04eae7b62967fa830bf8edfcd700b (diff) | |
| download | bcm5719-llvm-37c25fa1d15d2c1fd888b3e77c1928547e7542d1.tar.gz bcm5719-llvm-37c25fa1d15d2c1fd888b3e77c1928547e7542d1.zip | |
Add Available Externally linkage type to isWeakForLinker()
Per LangRef: "Globals with available_externally linkage are
allowed to be discarded at will, and are otherwise the same
as linkonce_odr", since linkonce_odr is in this list it makes
sense to have available_externally there as well.
Reviewers: rafael
Differential Revision: http://reviews.llvm.org/D15323
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 255043
Diffstat (limited to 'llvm/test/Transforms/GlobalOpt')
| -rw-r--r-- | llvm/test/Transforms/GlobalOpt/available_externally_global_ctors.ll | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/Transforms/GlobalOpt/available_externally_global_ctors.ll b/llvm/test/Transforms/GlobalOpt/available_externally_global_ctors.ll new file mode 100644 index 00000000000..39dc054ac22 --- /dev/null +++ b/llvm/test/Transforms/GlobalOpt/available_externally_global_ctors.ll @@ -0,0 +1,22 @@ +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-apple-macosx10.11.0" + +; RUN: opt -S -globalopt < %s | FileCheck %s + +; Verify that the initialization of the available_externally global is not eliminated +; CHECK: @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @foo_static_init, i8* null }] + +@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @foo_static_init, i8* null }] +@foo_external = available_externally global void ()* null, align 8 + +define internal void @foo_static_init() { +entry: + store void ()* @foo_impl, void ()** @foo_external, align 8 + ret void +} + +define internal void @foo_impl() { +entry: + ret void +} + |

