Initial testcases for scalar replacement of aggregates pass
[oota-llvm.git] / test / Transforms / ScalarRepl / badarray.ll
diff --git a/test/Transforms/ScalarRepl/badarray.ll b/test/Transforms/ScalarRepl/badarray.ll
new file mode 100644 (file)
index 0000000..22e84f8
--- /dev/null
@@ -0,0 +1,10 @@
+; RUN: as < %s | opt -scalarrepl -mem2reg | dis | grep alloca
+
+int %test() {
+  %X = alloca [ 4 x int ]
+  %Y = getelementptr [4x int]* %X, long 0, long 6 ; Off end of array!
+  store int 0, int* %Y
+
+  %Z = load int* %Y
+  ret int %Z
+}