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:%.*]] = call i32 @test(i32 [[P_8_VAL]], i32 [[P_12_VAL]])
13 ; CHECK-NEXT: [[ARET:%.*]] = add i32 [[V]], [[RET]]
14 ; CHECK-NEXT: ret i32 [[ARET]]
17 %a.gep = getelementptr %T, ptr %p, i64 0, i32 3
18 %b.gep = getelementptr %T, ptr %p, i64 0, i32 2
19 %a = load i32, ptr %a.gep
20 %b = load i32, ptr %b.gep
22 %ret = call i32 @test(ptr %p)
23 %aret = add i32 %v, %ret
27 define i32 @caller() {
28 ; CHECK-LABEL: define {{[^@]+}}@caller() {
30 ; CHECK-NEXT: [[TMP0:%.*]] = getelementptr i8, ptr @G, i64 8
31 ; CHECK-NEXT: [[G_VAL:%.*]] = load i32, ptr [[TMP0]], align 4
32 ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr i8, ptr @G, i64 12
33 ; CHECK-NEXT: [[G_VAL1:%.*]] = load i32, ptr [[TMP1]], align 4
34 ; CHECK-NEXT: [[V:%.*]] = call i32 @test(i32 [[G_VAL]], i32 [[G_VAL1]])
35 ; CHECK-NEXT: ret i32 [[V]]
38 %v = call i32 @test(ptr @G)