New testcase
authorChris Lattner <sabre@nondot.org>
Tue, 30 Apr 2002 19:50:47 +0000 (19:50 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 30 Apr 2002 19:50:47 +0000 (19:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2419 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/Mem2Reg/PromoteMemToRegister.ll [new file with mode: 0644]

diff --git a/test/Transforms/Mem2Reg/PromoteMemToRegister.ll b/test/Transforms/Mem2Reg/PromoteMemToRegister.ll
new file mode 100644 (file)
index 0000000..aacf5bf
--- /dev/null
@@ -0,0 +1,27 @@
+; Simple sanity check testcase.  Both alloca's should be eliminated.
+; RUN: if as < %s | opt -mem2reg | dis | grep 'alloca'
+; RUN: then exit 1
+; RUN: else exit 0
+; RUN: fi
+
+implementation
+
+double "testfunc"(int %i, double %j)
+begin
+       %I = alloca int
+       %J = alloca double
+
+       store int %i, int* %I
+       store double %j, double* %J
+
+       %t1 = load int* %I
+       %t2 = add int %t1, 1
+       store int %t2, int* %I
+
+       %t3 = load int* %I
+       %t4 = cast int %t3 to double
+       %t5 = load double* %J
+       %t6 = mul double %t4, %t5
+
+       ret double %t6
+end