aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/DeadArgElim
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-10-22 22:33:59 +0000
committerChris Lattner <sabre@nondot.org>2003-10-22 22:33:59 +0000
commitde0dcc35931d8ffbbba7d08a0629c5ee88f32df7 (patch)
tree20db1b85f5264d7caa7fb815256eafce3feaea7a /test/Transforms/DeadArgElim
parent3692fd97a6fb832f010bd269a7c65d010c518440 (diff)
downloadexternal_llvm-de0dcc35931d8ffbbba7d08a0629c5ee88f32df7.zip
external_llvm-de0dcc35931d8ffbbba7d08a0629c5ee88f32df7.tar.gz
external_llvm-de0dcc35931d8ffbbba7d08a0629c5ee88f32df7.tar.bz2
New testcase for the deadreturnvalue deletion extension to -deadargelim
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9389 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/DeadArgElim')
-rw-r--r--test/Transforms/DeadArgElim/deadretval.ll19
-rw-r--r--test/Transforms/DeadArgElim/deadretval2.ll36
2 files changed, 55 insertions, 0 deletions
diff --git a/test/Transforms/DeadArgElim/deadretval.ll b/test/Transforms/DeadArgElim/deadretval.ll
new file mode 100644
index 0000000..33b4bd7
--- /dev/null
+++ b/test/Transforms/DeadArgElim/deadretval.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -deadargelim | llvm-dis | not grep DEAD
+
+implementation
+
+internal int %test(int %DEADARG) { ; Dead arg only used by dead retval
+ ret int %DEADARG
+}
+
+int %test2(int %A) {
+ %DEAD = call int %test(int %A)
+ ret int 123
+}
+
+int %test3() {
+ %X = call int %test2(int 3232)
+ %Y = add int %X, -123
+ ret int %Y
+}
+
diff --git a/test/Transforms/DeadArgElim/deadretval2.ll b/test/Transforms/DeadArgElim/deadretval2.ll
new file mode 100644
index 0000000..2596fa6
--- /dev/null
+++ b/test/Transforms/DeadArgElim/deadretval2.ll
@@ -0,0 +1,36 @@
+; RUN: llvm-as < %s | opt -deadargelim -die | llvm-dis | not grep DEAD
+
+%P = external global int
+
+implementation
+
+
+internal int %test(int %DEADARG) { ; Dead arg only used by dead retval
+ ret int %DEADARG
+}
+
+internal int %test2(int %DEADARG) {
+ %DEADRETVAL = call int %test(int %DEADARG)
+ ret int %DEADRETVAL
+}
+
+void %test3(int %X) {
+ %DEADRETVAL = call int %test2(int %X)
+ ret void
+}
+
+internal int %foo() {
+ %DEAD = load int* %P
+ ret int %DEAD
+}
+
+internal int %id(int %X) {
+ ret int %X
+}
+
+void %test4() {
+ %DEAD = call int %foo()
+ %DEAD2 = call int %id(int %DEAD)
+ ret void
+}
+