1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
2 ; RUN: opt < %s -argpromotion -S | FileCheck %s
3 ; RUN: opt < %s -passes=argpromotion -S | FileCheck %s
5 %T = type { i32, i32, i32, i32 }
6 @G = constant %T { i32 0, i32 0, i32 17, i32 25 }
8 define internal i32 @test(%T* %p) {
9 ; CHECK-LABEL: define {{[^@]+}}@test
10 ; CHECK-SAME: (i32 [[P_0_3_VAL:%.*]]) {
12 ; CHECK-NEXT: [[V:%.*]] = add i32 [[P_0_3_VAL]], 10
13 ; CHECK-NEXT: ret i32 [[V]]
16 %a.gep = getelementptr %T, %T* %p, i64 0, i32 3
17 %b.gep = getelementptr %T, %T* %p, i64 0, i32 2
18 %a = load i32, i32* %a.gep
23 define i32 @caller() {
24 ; CHECK-LABEL: define {{[^@]+}}@caller() {
26 ; CHECK-NEXT: [[G_IDX:%.*]] = getelementptr [[T:%.*]], %T* @G, i64 0, i32 3
27 ; CHECK-NEXT: [[G_IDX_VAL:%.*]] = load i32, i32* [[G_IDX]], align 4
28 ; CHECK-NEXT: [[V:%.*]] = call i32 @test(i32 [[G_IDX_VAL]])
29 ; CHECK-NEXT: ret i32 [[V]]
32 %v = call i32 @test(%T* @G)