aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2012-06-25 14:30:31 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2012-06-25 14:30:31 +0000
commita0706a9ff4469b137ed6eea3f484a0152bab4c88 (patch)
tree06c3465b1a53ae509952654d3842b2d59bf80a27 /test
parentccaddf47086742f62fb7fbf97f6509395f31b957 (diff)
downloadexternal_llvm-a0706a9ff4469b137ed6eea3f484a0152bab4c88.zip
external_llvm-a0706a9ff4469b137ed6eea3f484a0152bab4c88.tar.gz
external_llvm-a0706a9ff4469b137ed6eea3f484a0152bab4c88.tar.bz2
If a constant or a function has linkonce_odr linkage and unnamed_addr, mark it
hidden. Being linkonce_odr guarantees that it is available in every dso that needs it. Being a constant/function with unnamed_addr guarantees that the copies don't have to be merged. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159136 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/GlobalOpt/hidden.ll14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/Transforms/GlobalOpt/hidden.ll b/test/Transforms/GlobalOpt/hidden.ll
new file mode 100644
index 0000000..301e158
--- /dev/null
+++ b/test/Transforms/GlobalOpt/hidden.ll
@@ -0,0 +1,14 @@
+; RUN: opt %s -globalopt -S | FileCheck %s
+
+@foo = linkonce_odr unnamed_addr constant i32 42
+; CHECK: @foo = linkonce_odr hidden unnamed_addr constant i32 42
+
+define linkonce_odr void @bar() unnamed_addr {
+; CHECK: define linkonce_odr hidden void @bar() unnamed_addr {
+ ret void
+}
+
+define i32* @zed() {
+ call void @bar()
+ ret i32* @foo
+}