1 ; RUN: opt < %s -deadargelim -die -S > %t
2 ; RUN: cat %t | not grep DEAD
3 ; RUN: cat %t | grep LIVE | count 4
5 @P = external global i32 ; <i32*> [#uses=1]
7 ; Dead arg only used by dead retval
8 define internal i32 @test(i32 %DEADARG) {
12 define internal i32 @test2(i32 %DEADARG) {
13 %DEADRETVAL = call i32 @test( i32 %DEADARG ) ; <i32> [#uses=1]
17 define void @test3(i32 %X) {
18 %DEADRETVAL = call i32 @test2( i32 %X ) ; <i32> [#uses=0]
22 define internal i32 @foo() {
23 %DEAD = load i32, i32* @P ; <i32> [#uses=1]
27 define internal i32 @id(i32 %X) {
31 define void @test4() {
32 %DEAD = call i32 @foo( ) ; <i32> [#uses=1]
33 %DEAD2 = call i32 @id( i32 %DEAD ) ; <i32> [#uses=0]
37 ; These test if returning another functions return value properly marks that
38 ; other function's return value as live. We do this twice, with the functions in
39 ; different orders (ie, first the caller, than the callee and first the callee
40 ; and then the caller) since DAE processes functions one by one and handles
41 ; these cases slightly different.
43 define internal i32 @test5() {
48 %LIVE = call i32 @test5()
53 %LIVE = call i32 @test8()
57 define internal i32 @test8() {