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 | 30be8a30ccc87cf741055d0f0ffa9116e8fd5efe (patch) | |
tree | 56e92dba44b789133a1921d8d55987fba0d7752b /llvm/test/Other/extract-linkonce.ll | |
parent | 743bf67caf459eb3f9ca8043b02986a00e77a8f6 (diff) | |
download | bcm5719-llvm-30be8a30ccc87cf741055d0f0ffa9116e8fd5efe.tar.gz bcm5719-llvm-30be8a30ccc87cf741055d0f0ffa9116e8fd5efe.zip |
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.
llvm-svn: 176459
Diffstat (limited to 'llvm/test/Other/extract-linkonce.ll')
-rw-r--r-- | llvm/test/Other/extract-linkonce.ll | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/test/Other/extract-linkonce.ll b/llvm/test/Other/extract-linkonce.ll new file mode 100644 index 00000000000..31fbf3ac463 --- /dev/null +++ b/llvm/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 +} |