aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2009-03-06 10:21:56 +0000
committerDuncan Sands <baldrick@free.fr>2009-03-06 10:21:56 +0000
commit0c7b63356c52e94b98d574343c581ca196cb1a2d (patch)
tree6821f5daf4f09326efad2f6baaab28e155212077 /test
parent5e522a9e6a77ac0d263ea6e587adbe37590543b6 (diff)
downloadexternal_llvm-0c7b63356c52e94b98d574343c581ca196cb1a2d.zip
external_llvm-0c7b63356c52e94b98d574343c581ca196cb1a2d.tar.gz
external_llvm-0c7b63356c52e94b98d574343c581ca196cb1a2d.tar.bz2
While thinking about the one-definition-rule and trying
to find a tiny mouse hole to squeeze through, it struck me that globals without a name can be considered internal since they can't be referenced from outside the current module. This patch makes GlobalOpt give them internal linkage. Also done for aliases even though they always have names, since in my opinion anonymous aliases should be allowed for consistency with global variables and functions. So if that happens one day, this code is ready! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66267 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/GlobalOpt/2009-03-06-Anonymous.ll11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/Transforms/GlobalOpt/2009-03-06-Anonymous.ll b/test/Transforms/GlobalOpt/2009-03-06-Anonymous.ll
new file mode 100644
index 0000000..ea13d29
--- /dev/null
+++ b/test/Transforms/GlobalOpt/2009-03-06-Anonymous.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | grep internal | count 2
+
+global i32 0
+define i32* @1() {
+ ret i32* @0
+}
+define i32* @f() {
+entry:
+ call i32* @1()
+ ret i32* %0
+}