blob: fc84dca1a952d3dd58843e4aad5e05e8a0eaaaf0 [file] [log] [blame]
Matthijs Kooijman35252282008-06-20 15:38:22 +00001; RUN: llvm-as < %s | opt -deadargelim | llvm-dis > %t
2; RUN: cat %t | grep {define internal \{ \} @test}
3; RUN: cat %t | grep {define internal \{ i32 \} @test}
4; RUN: cat %t | grep {define internal \<\{ i32, i32 \}\> @test}
5
6; Check if the pass doesn't modify anything that doesn't need changing. We feed
7; an unused argument to each function to lure it into changing _something_ about
Matthijs Kooijman54a1fe62008-07-15 13:15:10 +00008; the function and then changing too much.
Matthijs Kooijman35252282008-06-20 15:38:22 +00009
10
11; This checks if the struct retval isn't changed into a void
12define internal { } @test(i32 %DEADARG1) {
13 ret { } { }
14}
15
16; This checks if the struct retval isn't removed
17define internal {i32} @test1(i32 %DEADARG1) {
18 ret { i32 } { i32 1 }
19}
20
21; This checks if the struct doesn't get non-packed
22define internal <{ i32, i32 }> @test2(i32 %DEADARG1) {
23 ret <{ i32, i32 }> <{ i32 1, i32 2 }>
24}
25
26; We use this external function to make sure the return values don't become dead
27declare void @user({ }, { i32 }, <{ i32, i32 }>)
28
29define void @caller() {
30 %A = call { } @test(i32 0)
31 %B = call { i32 } @test1(i32 1)
32 %C = call <{ i32, i32 }> @test2(i32 2)
33 call void @user({ } %A, { i32 } %B, <{ i32, i32 }> %C)
34 ret void
35}
36