From de0dcc35931d8ffbbba7d08a0629c5ee88f32df7 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9389 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/DeadArgElim/deadretval.ll | 19 ++++++++++++ test/Transforms/DeadArgElim/deadretval2.ll | 36 ++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 test/Transforms/DeadArgElim/deadretval.ll create mode 100644 test/Transforms/DeadArgElim/deadretval2.ll diff --git a/test/Transforms/DeadArgElim/deadretval.ll b/test/Transforms/DeadArgElim/deadretval.ll new file mode 100644 index 00000000000..33b4bd7cb6b --- /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 00000000000..2596fa66fa2 --- /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 +} + -- 2.40.0