blob: 678033e2b56ed53a95b4a6b84f04c25ed395bed6 [file] [log] [blame]
Matthijs Kooijman35252282008-06-20 15:38:22 +00001; RUN: llvm-as < %s | opt -deadargelim | llvm-dis > %t
Devang Patelcd842482008-09-29 20:49:50 +00002; RUN: cat %t | grep {define internal zeroext i32 @test1() nounwind}
Matthijs Kooijman35252282008-06-20 15:38:22 +00003; RUN: cat %t | grep {define internal \<\{ i32, i32 \}\> @test}
4
5; Check if the pass doesn't modify anything that doesn't need changing. We feed
6; an unused argument to each function to lure it into changing _something_ about
Matthijs Kooijman54a1fe62008-07-15 13:15:10 +00007; the function and then changing too much.
Matthijs Kooijman35252282008-06-20 15:38:22 +00008
Matthijs Kooijman5e67fe22008-07-15 14:57:01 +00009; This checks if the return value attributes are not removed
Devang Patelcd842482008-09-29 20:49:50 +000010define internal zeroext i32 @test1(i32 %DEADARG1) nounwind {
Matthijs Kooijman5e67fe22008-07-15 14:57:01 +000011 ret i32 1
Matthijs Kooijman35252282008-06-20 15:38:22 +000012}
13
14; This checks if the struct doesn't get non-packed
15define internal <{ i32, i32 }> @test2(i32 %DEADARG1) {
16 ret <{ i32, i32 }> <{ i32 1, i32 2 }>
17}
18
19; We use this external function to make sure the return values don't become dead
Matthijs Kooijman5e67fe22008-07-15 14:57:01 +000020declare void @user(i32, <{ i32, i32 }>)
Matthijs Kooijman35252282008-06-20 15:38:22 +000021
22define void @caller() {
Matthijs Kooijman5e67fe22008-07-15 14:57:01 +000023 %B = call i32 @test1(i32 1)
Matthijs Kooijman35252282008-06-20 15:38:22 +000024 %C = call <{ i32, i32 }> @test2(i32 2)
Matthijs Kooijman5e67fe22008-07-15 14:57:01 +000025 call void @user(i32 %B, <{ i32, i32 }> %C)
Matthijs Kooijman35252282008-06-20 15:38:22 +000026 ret void
27}
28