new testcase
authorChris Lattner <sabre@nondot.org>
Tue, 27 Jul 2004 06:35:11 +0000 (06:35 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 27 Jul 2004 06:35:11 +0000 (06:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15259 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/GlobalsModRef/purecse.ll [new file with mode: 0644]

diff --git a/test/Analysis/GlobalsModRef/purecse.ll b/test/Analysis/GlobalsModRef/purecse.ll
new file mode 100644 (file)
index 0000000..17e6a0a
--- /dev/null
@@ -0,0 +1,15 @@
+; Test that pure functions are cse'd away
+
+; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse -instcombine -adce| llvm-dis | not grep call
+
+int %pure(int %X) {
+       %Y = add int %X, 1
+       ret int %Y
+}
+
+int %test(int %X) {
+       %A = call int %pure(int %X)
+       %B = call int %pure(int %X)
+       %C = sub int %A, %B
+       ret int %C
+}