1 ; RUN: opt < %s -argpromotion -S | FileCheck %s
2 ; RUN: opt < %s -passes=argpromotion -S | FileCheck %s
4 ; Arg promotion eliminates the struct argument.
5 ; FIXME: Should it eliminate the i32* argument?
7 %struct.ss = type { i32, i64 }
9 define internal void @f(%struct.ss* byval %b, i32* byval %X) nounwind {
10 ; CHECK-LABEL: define internal void @f(i32 %b.0, i64 %b.1, i32* byval %X)
12 %tmp = getelementptr %struct.ss, %struct.ss* %b, i32 0, i32 0
13 %tmp1 = load i32, i32* %tmp, align 4
14 %tmp2 = add i32 %tmp1, 1
15 store i32 %tmp2, i32* %tmp, align 4
21 define i32 @test(i32* %X) {
22 ; CHECK-LABEL: define i32 @test
24 %S = alloca %struct.ss
25 %tmp1 = getelementptr %struct.ss, %struct.ss* %S, i32 0, i32 0
26 store i32 1, i32* %tmp1, align 8
27 %tmp4 = getelementptr %struct.ss, %struct.ss* %S, i32 0, i32 1
28 store i64 2, i64* %tmp4, align 4
29 call void @f( %struct.ss* byval %S, i32* byval %X)
30 ; CHECK: call void @f(i32 %{{.*}}, i64 %{{.*}}, i32* byval %{{.*}})