aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-10-11 05:00:30 +0000
committerChris Lattner <sabre@nondot.org>2004-10-11 05:00:30 +0000
commitc58cf5b921b8fc57fde7322d6545e8fc85798a48 (patch)
tree9ccddf73d966c6defbb71276a4e530b1b841b48e /test
parent95d0bbfda63c9f1a477ea206d8b75855557a8248 (diff)
downloadexternal_llvm-c58cf5b921b8fc57fde7322d6545e8fc85798a48.zip
external_llvm-c58cf5b921b8fc57fde7322d6545e8fc85798a48.tar.gz
external_llvm-c58cf5b921b8fc57fde7322d6545e8fc85798a48.tar.bz2
This testcase ensures that we can SRA a global even if part of the global
cannot be SRA'd git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16915 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/GlobalOpt/globalsra-partial.llx23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/Transforms/GlobalOpt/globalsra-partial.llx b/test/Transforms/GlobalOpt/globalsra-partial.llx
new file mode 100644
index 0000000..9b3788e
--- /dev/null
+++ b/test/Transforms/GlobalOpt/globalsra-partial.llx
@@ -0,0 +1,23 @@
+; In this case, the global can only be broken up by one level.
+
+; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep 12345
+
+%G = internal global { int, [4 x float] } zeroinitializer
+
+void %onlystore() {
+ store int 12345, int* getelementptr ({ int, [4 x float] }* %G, int 0, uint 0)
+ ret void
+}
+
+void %storeinit(int %i) {
+ %Ptr = getelementptr { int, [4 x float] }* %G, int 0, uint 1, int %i
+ store float 1.0, float* %Ptr
+ ret void
+}
+
+float %readval(int %i) {
+ %Ptr = getelementptr { int, [4 x float] }* %G, int 0, uint 1, int %i
+ %V = load float* %Ptr
+ ret float %V
+}
+