1; RUN: opt < %s -argpromotion -S | FileCheck %s 2; PR36543 3 4; Don't promote arguments of musttail callee 5 6%T = type { i32, i32, i32, i32 } 7 8; CHECK-LABEL: define internal i32 @test(%T* %p) 9define internal i32 @test(%T* %p) { 10 %a.gep = getelementptr %T, %T* %p, i64 0, i32 3 11 %b.gep = getelementptr %T, %T* %p, i64 0, i32 2 12 %a = load i32, i32* %a.gep 13 %b = load i32, i32* %b.gep 14 %v = add i32 %a, %b 15 ret i32 %v 16} 17 18; CHECK-LABEL: define i32 @caller(%T* %p) 19define i32 @caller(%T* %p) { 20 %v = musttail call i32 @test(%T* %p) 21 ret i32 %v 22} 23 24; Don't promote arguments of musttail caller 25 26define i32 @foo(%T* %p, i32 %v) { 27 ret i32 0 28} 29 30; CHECK-LABEL: define internal i32 @test2(%T* %p, i32 %p2) 31define internal i32 @test2(%T* %p, i32 %p2) { 32 %a.gep = getelementptr %T, %T* %p, i64 0, i32 3 33 %b.gep = getelementptr %T, %T* %p, i64 0, i32 2 34 %a = load i32, i32* %a.gep 35 %b = load i32, i32* %b.gep 36 %v = add i32 %a, %b 37 %ca = musttail call i32 @foo(%T* undef, i32 %v) 38 ret i32 %ca 39} 40 41; CHECK-LABEL: define i32 @caller2(%T* %g) 42define i32 @caller2(%T* %g) { 43 %v = call i32 @test2(%T* %g, i32 0) 44 ret i32 %v 45} 46