1c0cfdd32SJohannes Doerfert; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes 2217e8576SNikita Popov; RUN: opt < %s -passes=argpromotion,mem2reg -S | FileCheck %s 3cee313d2SEric Christophertarget datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" 4cee313d2SEric Christopher 5*bcbc6151SNikita Popovdefine internal i32 @test(ptr %X, ptr %Y) { 6c0cfdd32SJohannes Doerfert; CHECK-LABEL: define {{[^@]+}}@test 7a2ce8df4SValery Pykhtin; CHECK-SAME: (i32 [[X_0_VAL:%.*]], i32 [[Y_0_VAL:%.*]]) { 8a2ce8df4SValery Pykhtin; CHECK-NEXT: [[C:%.*]] = add i32 [[X_0_VAL]], [[Y_0_VAL]] 9c0cfdd32SJohannes Doerfert; CHECK-NEXT: ret i32 [[C]] 10c0cfdd32SJohannes Doerfert; 11*bcbc6151SNikita Popov %A = load i32, ptr %X 12*bcbc6151SNikita Popov %B = load i32, ptr %Y 13cee313d2SEric Christopher %C = add i32 %A, %B 14cee313d2SEric Christopher ret i32 %C 15cee313d2SEric Christopher} 16cee313d2SEric Christopher 17*bcbc6151SNikita Popovdefine internal i32 @caller(ptr %B) { 18c0cfdd32SJohannes Doerfert; CHECK-LABEL: define {{[^@]+}}@caller 19a2ce8df4SValery Pykhtin; CHECK-SAME: (i32 [[B_0_VAL:%.*]]) { 20a2ce8df4SValery Pykhtin; CHECK-NEXT: [[C:%.*]] = call i32 @test(i32 1, i32 [[B_0_VAL]]) 21c0cfdd32SJohannes Doerfert; CHECK-NEXT: ret i32 [[C]] 22c0cfdd32SJohannes Doerfert; 23cee313d2SEric Christopher %A = alloca i32 24*bcbc6151SNikita Popov store i32 1, ptr %A 25*bcbc6151SNikita Popov %C = call i32 @test(ptr %A, ptr %B) 26cee313d2SEric Christopher ret i32 %C 27cee313d2SEric Christopher} 28cee313d2SEric Christopher 29cee313d2SEric Christopherdefine i32 @callercaller() { 30a2ce8df4SValery Pykhtin; CHECK-LABEL: define {{[^@]+}}@callercaller() { 31c0cfdd32SJohannes Doerfert; CHECK-NEXT: [[X:%.*]] = call i32 @caller(i32 2) 32c0cfdd32SJohannes Doerfert; CHECK-NEXT: ret i32 [[X]] 33c0cfdd32SJohannes Doerfert; 34cee313d2SEric Christopher %B = alloca i32 35*bcbc6151SNikita Popov store i32 2, ptr %B 36*bcbc6151SNikita Popov %X = call i32 @caller(ptr %B) 37cee313d2SEric Christopher ret i32 %X 38cee313d2SEric Christopher} 39cee313d2SEric Christopher 40