summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2012-06-14 22:48:13 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2012-06-14 22:48:13 +0000
commit0397729d3b8da4208660a163d18296b1a3bd32b8 (patch)
tree06128ec39f9c9771e28692b44a8ceb8edb41e338 /test
parent312091ece3e7860cea0410318cf1e06cea75954e (diff)
downloadllvm-0397729d3b8da4208660a163d18296b1a3bd32b8.tar.gz
llvm-0397729d3b8da4208660a163d18296b1a3bd32b8.tar.bz2
llvm-0397729d3b8da4208660a163d18296b1a3bd32b8.tar.xz
Implement the isSafeToDiscardIfUnused predicate and use it in globalopt and
globaldce. Globaldce was already removing linkonce globals, but globalopt was not. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158476 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/GlobalOpt/deadglobal.ll24
1 files changed, 20 insertions, 4 deletions
diff --git a/test/Transforms/GlobalOpt/deadglobal.ll b/test/Transforms/GlobalOpt/deadglobal.ll
index c8d8e7674d..cad5a91488 100644
--- a/test/Transforms/GlobalOpt/deadglobal.ll
+++ b/test/Transforms/GlobalOpt/deadglobal.ll
@@ -1,9 +1,25 @@
-; RUN: opt < %s -globalopt -S | not grep internal
+; RUN: opt < %s -globalopt -S | FileCheck %s
-@G = internal global i32 123 ; <i32*> [#uses=1]
+@G1 = internal global i32 123 ; <i32*> [#uses=1]
-define void @foo() {
- store i32 1, i32* @G
+; CHECK-NOT: @G1
+; CHECK: @G2
+; CHECK-NOT: @G3
+
+define void @foo1() {
+; CHECK: define void @foo
+; CHECK-NEXT: ret
+ store i32 1, i32* @G1
+ ret void
+}
+
+@G2 = linkonce_odr constant i32 42
+
+define void @foo2() {
+; CHECK: define void @foo2
+; CHECK-NEXT: store
+ store i32 1, i32* @G2
ret void
}
+@G3 = linkonce_odr constant i32 42