diff options
author | Lang Hames <lhames@gmail.com> | 2013-03-04 22:40:44 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2013-03-04 22:40:44 +0000 |
commit | 880e8c0ad41345f353b819c51092baa8f05e1950 (patch) | |
tree | cc1c3b1b23a1d95e11f0d324c7d2a2d4f20e5502 /test/Other | |
parent | 1ae08e007784a0708d6dae9c37b84bb62d5e1282 (diff) |
Check isDiscardableIfUnused, rather than hasLocalLinkage, when bumping
GlobalValue linkage up to ExternalLinkage in the ExtractGV pass. This
prevents linkonce and linkonce_odr symbols from being DCE'd.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176459 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Other')
-rw-r--r-- | test/Other/extract-linkonce.ll | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/Other/extract-linkonce.ll b/test/Other/extract-linkonce.ll new file mode 100644 index 0000000000..31fbf3ac46 --- /dev/null +++ b/test/Other/extract-linkonce.ll @@ -0,0 +1,23 @@ +; RUN: llvm-extract -func foo -S < %s | FileCheck %s +; RUN: llvm-extract -delete -func foo -S < %s | FileCheck --check-prefix=DELETE %s + +; Test that we don't convert weak_odr to external definitions. + +; CHECK: @bar = external hidden global i32 +; CHECK: define hidden i32* @foo() { +; CHECK-NEXT: ret i32* @bar +; CHECK-NEXT: } + +; DELETE: @bar = hidden global i32 42 +; DELETE: declare hidden i32* @foo() + +@bar = linkonce global i32 42 + +define linkonce i32* @foo() { + ret i32* @bar +} + +define void @g() { + call i32* @foo() + ret void +} |