aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-04-18 17:35:39 +0000
committerChris Lattner <sabre@nondot.org>2002-04-18 17:35:39 +0000
commitfe053c77c1cb5ba9094f7de352959a876d39c518 (patch)
tree30de154c6fd47f789ec9b63d5cd43deb6f28fb2b /test/Transforms
parent0e743b83976dd9b31c8fc7ad19f61c30b743dedf (diff)
downloadexternal_llvm-fe053c77c1cb5ba9094f7de352959a876d39c518.zip
external_llvm-fe053c77c1cb5ba9094f7de352959a876d39c518.tar.gz
external_llvm-fe053c77c1cb5ba9094f7de352959a876d39c518.tar.bz2
New testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2291 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/InstCombine/add.ll32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/add.ll b/test/Transforms/InstCombine/add.ll
new file mode 100644
index 0000000..a8793a7
--- /dev/null
+++ b/test/Transforms/InstCombine/add.ll
@@ -0,0 +1,32 @@
+; This test makes sure that add instructions are properly eliminated.
+;
+; This also tests that a subtract with a constant is properly converted
+; to a add w/negative constant
+
+; RUN: if as < %s | opt -instcombine -dce | dis | grep add
+; RUN: then exit 1
+; RUN: else exit 0
+; RUN: fi
+
+implementation
+
+int "test1"(int %A)
+begin
+ %B = add int %A, 0
+ ret int %B
+end
+
+int "test2"(int %A)
+begin
+ %B = add int %A, 5
+ %C = add int %B, -5
+ ret int %C
+end
+
+int "test3"(int %A)
+begin
+ %B = add int %A, 5
+ %C = sub int %B, 5 ;; This should get converted to an add
+ ret int %C
+end
+