1 ; RUN: opt -O3 -S < %s | FileCheck %s
3 ; Arg promotion eliminates the struct argument but may leave dead arguments after its work
5 %struct.ss = type { i32, i64 }
8 ; CHECK: [[DUMMY:@.*]] = local_unnamed_addr global i32 0
10 define internal void @f(ptr byval(%struct.ss) align 8 %b, ptr byval(i32) align 4 %X) noinline nounwind {
11 ; CHECK-LABEL: define {{[^@]+}}@f
12 ; CHECK-SAME: (i32 [[B_0:%.*]]){{[^#]*}} #[[ATTR0:[0-9]+]] {
14 ; CHECK-NEXT: [[TEMP:%.*]] = add i32 [[B_0]], 1
15 ; CHECK-NEXT: store i32 [[TEMP]], ptr [[DUMMY]], align 4
16 ; CHECK-NEXT: ret void
19 %temp1 = load i32, ptr %b, align 4
20 %temp2 = add i32 %temp1, 1
21 store i32 %temp2, ptr @dummy
22 store i32 %temp2, ptr %X
26 define i32 @test(ptr %X) {
27 ; CHECK-LABEL: define {{[^@]+}}@test
28 ; CHECK-SAME: (ptr {{[^%]*}} [[X:%.*]]){{[^#]*}} #[[ATTR1:[0-9]+]] {
30 ; CHECK-NEXT: tail call {{.*}}void @f(i32 1)
31 ; CHECK-NEXT: ret i32 0
34 %S = alloca %struct.ss, align 8
35 store i32 1, ptr %S, align 8
36 %temp4 = getelementptr %struct.ss, ptr %S, i32 0, i32 1
37 store i64 2, ptr %temp4, align 4
38 call void @f( ptr byval(%struct.ss) align 8 %S, ptr byval(i32) align 4 %X)