diff options
| author | Mehdi Amini <mehdi.amini@apple.com> | 2015-12-09 16:17:07 +0000 |
|---|---|---|
| committer | Mehdi Amini <mehdi.amini@apple.com> | 2015-12-09 16:17:07 +0000 |
| commit | b000bbdec22c555746686f7d937ce9b7c7fd77e9 (patch) | |
| tree | 32fafa3d02631f25aa940259cdc251a70b6032d3 /llvm/test/Transforms | |
| parent | 9cd9a7e310933b147e22220cdcea4bd6263be5fb (diff) | |
| download | bcm5719-llvm-b000bbdec22c555746686f7d937ce9b7c7fd77e9.tar.gz bcm5719-llvm-b000bbdec22c555746686f7d937ce9b7c7fd77e9.zip | |
Change hasUniqueInitializer() to call isStrongDefinitionForLinker() instead of !isWeakForLinker()
Summary:
Available_externally global variable with initializer were considered "hasInitializer()",
while obviously it can't match the description:
Whether the global variable has an initializer, and any changes made to the
initializer will turn up in the final executable.
since modifying the initializer of an externally available variable does not make sense.
Reviewers: pcc, rafael
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D15351
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 255123
Diffstat (limited to 'llvm/test/Transforms')
| -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..7092a5ae222 --- /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 + +define internal void @foo_static_init() { +entry: + store void ()* @foo_impl, void ()** @foo_external + ret void +} + +define internal void @foo_impl() { +entry: + ret void +} + |

