1 ; RUN: opt < %s -argpromotion -S | FileCheck %s
2 ; RUN: opt < %s -passes=argpromotion -S | FileCheck %s
4 %T = type { i32, i32, i32, i32 }
5 @G = constant %T { i32 0, i32 0, i32 17, i32 25 }
7 define internal i32 @test(%T* %p) {
8 ; CHECK-LABEL: define internal i32 @test(
9 ; CHECK: i32 %{{.*}}, i32 %{{.*}})
11 %a.gep = getelementptr %T, %T* %p, i64 0, i32 3
12 %b.gep = getelementptr %T, %T* %p, i64 0, i32 2
13 %a = load i32, i32* %a.gep
14 %b = load i32, i32* %b.gep
21 define i32 @caller() {
22 ; CHECK-LABEL: define i32 @caller(
24 %v = call i32 @test(%T* @G)
25 ; CHECK: %[[B_GEP:.*]] = getelementptr %T, %T* @G, i64 0, i32 2
26 ; CHECK: %[[B:.*]] = load i32, i32* %[[B_GEP]]
27 ; CHECK: %[[A_GEP:.*]] = getelementptr %T, %T* @G, i64 0, i32 3
28 ; CHECK: %[[A:.*]] = load i32, i32* %[[A_GEP]]
29 ; CHECK: call i32 @test(i32 %[[B]], i32 %[[A]])