1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
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(ptr %p) {
8 ; CHECK-LABEL: define {{[^@]+}}@test
9 ; CHECK-SAME: (i32 [[P_8_VAL:%.*]], i32 [[P_12_VAL:%.*]]) {
11 ; CHECK-NEXT: [[V:%.*]] = add i32 [[P_12_VAL]], [[P_8_VAL]]
12 ; CHECK-NEXT: ret i32 [[V]]
15 %a.gep = getelementptr %T, ptr %p, i64 0, i32 3
16 %b.gep = getelementptr %T, ptr %p, i64 0, i32 2
17 %a = load i32, ptr %a.gep
18 %b = load i32, ptr %b.gep
23 define i32 @caller() {
24 ; CHECK-LABEL: define {{[^@]+}}@caller() {
26 ; CHECK-NEXT: [[TMP0:%.*]] = getelementptr i8, ptr @G, i64 8
27 ; CHECK-NEXT: [[G_VAL:%.*]] = load i32, ptr [[TMP0]], align 4
28 ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr i8, ptr @G, i64 12
29 ; CHECK-NEXT: [[G_VAL1:%.*]] = load i32, ptr [[TMP1]], align 4
30 ; CHECK-NEXT: [[V:%.*]] = call i32 @test(i32 [[G_VAL]], i32 [[G_VAL1]])
31 ; CHECK-NEXT: ret i32 [[V]]
34 %v = call i32 @test(ptr @G)