1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
2 ; RUN: opt -S < %s -passes=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(ptr [[TEMP]], ptr [[TEMP1]])
15 ; CHECK-NEXT: ret i32 0
20 %temp2 = call i32 @test_inf_promote_callee(ptr %temp, ptr %temp1)
24 define internal i32 @test_inf_promote_callee(ptr %arg, ptr %arg1) {
25 ; CHECK-LABEL: define {{[^@]+}}@test_inf_promote_callee
26 ; CHECK-SAME: (ptr [[ARG:%.*]], ptr [[ARG1:%.*]]) {
28 ; CHECK-NEXT: [[TEMP2:%.*]] = load ptr, ptr [[ARG1]], align 8
29 ; CHECK-NEXT: [[TEMP4:%.*]] = load ptr, ptr [[ARG]], align 8
30 ; CHECK-NEXT: [[TEMP5:%.*]] = call i32 @test_inf_promote_callee2(ptr [[TEMP4]], ptr [[TEMP2]])
31 ; CHECK-NEXT: ret i32 0
34 %temp2 = load ptr, ptr %arg1
35 %temp4 = load ptr, ptr %arg
36 %temp5 = call i32 @test_inf_promote_callee2(ptr %temp4, ptr %temp2)
40 define internal i32 @test_inf_promote_callee2(ptr %arg, ptr %arg1) {
41 ; CHECK-LABEL: define {{[^@]+}}@test_inf_promote_callee2
42 ; CHECK-SAME: (ptr [[ARG:%.*]], ptr [[ARG1:%.*]]) {
43 ; CHECK-NEXT: [[R:%.*]] = call i32 @test_inf_promote_callee(ptr [[ARG]], ptr [[ARG1]])
44 ; CHECK-NEXT: ret i32 0
46 %r = call i32 @test_inf_promote_callee(ptr %arg, ptr %arg1)
50 declare i32 @wibble(...)