From b7c3faabcd9f93157709d5b169ea6183d5ae49a2 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 22 Oct 2003 22:33:59 +0000 Subject: [PATCH] New testcase for the deadreturnvalue deletion extension to -deadargelim llvm-svn: 9389 --- .../Transforms/DeadArgElim/deadretval.ll | 19 ++++++++++ .../Transforms/DeadArgElim/deadretval2.ll | 36 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 llvm/test/Regression/Transforms/DeadArgElim/deadretval.ll create mode 100644 llvm/test/Regression/Transforms/DeadArgElim/deadretval2.ll diff --git a/llvm/test/Regression/Transforms/DeadArgElim/deadretval.ll b/llvm/test/Regression/Transforms/DeadArgElim/deadretval.ll new file mode 100644 index 000000000000..33b4bd7cb6be --- /dev/null +++ b/llvm/test/Regression/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/llvm/test/Regression/Transforms/DeadArgElim/deadretval2.ll b/llvm/test/Regression/Transforms/DeadArgElim/deadretval2.ll new file mode 100644 index 000000000000..2596fa66fa2b --- /dev/null +++ b/llvm/test/Regression/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 +} +