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 3 4; This shouldn't get infinitely promoted. 5 6%S = type { ptr } 7 8define i32 @test_inf_promote_caller(i32 %arg) { 9; CHECK-LABEL: define {{[^@]+}}@test_inf_promote_caller 10; CHECK-SAME: (i32 [[ARG:%.*]]) { 11; CHECK-NEXT: bb: 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 16; 17bb: 18 %temp = alloca %S 19 %temp1 = alloca %S 20 %temp2 = call i32 @test_inf_promote_callee(ptr %temp, ptr %temp1) 21 ret i32 0 22} 23 24define 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:%.*]]) { 27; CHECK-NEXT: bb: 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 32; 33bb: 34 %temp2 = load ptr, ptr %arg1 35 %temp4 = load ptr, ptr %arg 36 %temp5 = call i32 @test_inf_promote_callee2(ptr %temp4, ptr %temp2) 37 ret i32 0 38} 39 40define 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 45; 46 %r = call i32 @test_inf_promote_callee(ptr %arg, ptr %arg1) 47 ret i32 0 48} 49 50declare i32 @wibble(...) 51