blob: e41110c96ef4562d5da5c191fa40ce3d14561359 [file] [log] [blame]
Bill Wendling90bc19c2013-02-20 07:21:42 +00001; RUN: opt < %s -deadargelim -S | FileCheck %s
Chris Lattnerb23aad02009-03-01 00:24:40 +00002
3%Ty = type <{ i32, i32 }>
Matthijs Kooijman48b282f2008-06-20 15:38:22 +00004
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 Kooijmand3374462008-07-15 13:15:10 +00007; the function and then changing too much.
Matthijs Kooijman48b282f2008-06-20 15:38:22 +00008
Matthijs Kooijman121a2062008-07-15 14:57:01 +00009; This checks if the return value attributes are not removed
Bill Wendling90bc19c2013-02-20 07:21:42 +000010; CHECK: define internal zeroext i32 @test1() #0
Devang Patel221fe422008-09-29 20:49:50 +000011define internal zeroext i32 @test1(i32 %DEADARG1) nounwind {
Matthijs Kooijman121a2062008-07-15 14:57:01 +000012 ret i32 1
Matthijs Kooijman48b282f2008-06-20 15:38:22 +000013}
14
15; This checks if the struct doesn't get non-packed
Bill Wendling90bc19c2013-02-20 07:21:42 +000016; CHECK: define internal <{ i32, i32 }> @test2
Matthijs Kooijman48b282f2008-06-20 15:38:22 +000017define internal <{ i32, i32 }> @test2(i32 %DEADARG1) {
18 ret <{ i32, i32 }> <{ i32 1, i32 2 }>
19}
20
21; We use this external function to make sure the return values don't become dead
Matthijs Kooijman121a2062008-07-15 14:57:01 +000022declare void @user(i32, <{ i32, i32 }>)
Matthijs Kooijman48b282f2008-06-20 15:38:22 +000023
24define void @caller() {
Matthijs Kooijman121a2062008-07-15 14:57:01 +000025 %B = call i32 @test1(i32 1)
Matthijs Kooijman48b282f2008-06-20 15:38:22 +000026 %C = call <{ i32, i32 }> @test2(i32 2)
Matthijs Kooijman121a2062008-07-15 14:57:01 +000027 call void @user(i32 %B, <{ i32, i32 }> %C)
Matthijs Kooijman48b282f2008-06-20 15:38:22 +000028 ret void
29}
30
Bill Wendling90bc19c2013-02-20 07:21:42 +000031; CHECK: attributes #0 = { nounwind }