1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
2 ; RUN: opt -S < %s -argpromotion | FileCheck %s
4 ; This shouldn't get infinitely promoted.
8 define i32 @test_inf_promote_caller(i32 %arg) {
9 ; CHECK-LABEL: define {{[^@]+}}@test_inf_promote_caller
10 ; CHECK-SAME: (i32 [[ARG:%.*]]) {
12 ; CHECK-NEXT: [[TEMP:%.*]] = alloca [[S:%.*]], align 8
13 ; CHECK-NEXT: [[TEMP1:%.*]] = alloca [[S]], align 8
14 ; CHECK-NEXT: [[TEMP2:%.*]] = call i32 @test_inf_promote_callee(%S* [[TEMP]], %S* [[TEMP1]])
15 ; CHECK-NEXT: ret i32 0
20 %temp2 = call i32 @test_inf_promote_callee(%S* %temp, %S* %temp1)
24 define internal i32 @test_inf_promote_callee(%S* %arg, %S* %arg1) {
25 ; CHECK-LABEL: define {{[^@]+}}@test_inf_promote_callee
26 ; CHECK-SAME: (%S* [[ARG:%.*]], %S* [[ARG1:%.*]]) {
28 ; CHECK-NEXT: [[TEMP:%.*]] = getelementptr [[S:%.*]], %S* [[ARG1]], i32 0, i32 0
29 ; CHECK-NEXT: [[TEMP2:%.*]] = load %S*, %S** [[TEMP]], align 8
30 ; CHECK-NEXT: [[TEMP3:%.*]] = getelementptr [[S]], %S* [[ARG]], i32 0, i32 0
31 ; CHECK-NEXT: [[TEMP4:%.*]] = load %S*, %S** [[TEMP3]], align 8
32 ; CHECK-NEXT: [[TEMP5:%.*]] = call i32 @test_inf_promote_callee2(%S* [[TEMP4]], %S* [[TEMP2]])
33 ; CHECK-NEXT: ret i32 0
36 %temp = getelementptr %S, %S* %arg1, i32 0, i32 0
37 %temp2 = load %S*, %S** %temp
38 %temp3 = getelementptr %S, %S* %arg, i32 0, i32 0
39 %temp4 = load %S*, %S** %temp3
40 %temp5 = call i32 @test_inf_promote_callee2(%S* %temp4, %S* %temp2)
44 define internal i32 @test_inf_promote_callee2(%S* %arg, %S* %arg1) {
45 ; CHECK-LABEL: define {{[^@]+}}@test_inf_promote_callee2
46 ; CHECK-SAME: (%S* [[ARG:%.*]], %S* [[ARG1:%.*]]) {
47 ; CHECK-NEXT: [[R:%.*]] = call i32 @test_inf_promote_callee(%S* [[ARG]], %S* [[ARG1]])
48 ; CHECK-NEXT: ret i32 0
50 %r = call i32 @test_inf_promote_callee(%S* %arg, %S* %arg1)
54 declare i32 @wibble(...)