1 ; RUN: opt < %s -argpromotion -S | FileCheck %s
4 ; Don't promote arguments of musttail callee
6 %T = type { i32, i32, i32, i32 }
8 ; CHECK-LABEL: define internal i32 @test(%T* %p)
9 define 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
18 ; CHECK-LABEL: define i32 @caller(%T* %p)
19 define i32 @caller(%T* %p) {
20 %v = musttail call i32 @test(%T* %p)
24 ; Don't promote arguments of musttail caller
26 define i32 @foo(%T* %p, i32 %v) {
30 ; CHECK-LABEL: define internal i32 @test2(%T* %p, i32 %p2)
31 define 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
37 %ca = musttail call i32 @foo(%T* undef, i32 %v)
41 ; CHECK-LABEL: define i32 @caller2(%T* %g)
42 define i32 @caller2(%T* %g) {
43 %v = call i32 @test2(%T* %g, i32 0)