1;PR15293: ARM codegen ice - expected larger existing stack allocation
2;RUN: llc -mtriple=arm-linux-gnueabihf < %s | FileCheck %s
3
4;CHECK-LABEL: foo:
5;CHECK: 	sub	sp, sp, #16
6;CHECK: 	push	{r11, lr}
7;CHECK: 	str	r0, [sp, #8]
8;CHECK: 	add	r0, sp, #8
9;CHECK: 	bl	fooUseParam
10;CHECK: 	pop	{r11, lr}
11;CHECK: 	add	sp, sp, #16
12;CHECK: 	mov	pc, lr
13
14;CHECK-LABEL: foo2:
15;CHECK: 	sub	sp, sp, #16
16;CHECK: 	push	{r11, lr}
17;CHECK: 	str	r0, [sp, #8]
18;CHECK: 	add	r0, sp, #8
19;CHECK: 	str	r2, [sp, #16]
20;CHECK: 	bl	fooUseParam
21;CHECK: 	add	r0, sp, #16
22;CHECK: 	bl	fooUseParam
23;CHECK: 	pop	{r11, lr}
24;CHECK: 	add	sp, sp, #16
25;CHECK: 	mov	pc, lr
26
27;CHECK-LABEL: doFoo:
28;CHECK: 	push	{r11, lr}
29;CHECK: 	ldr	r0,
30;CHECK: 	ldr	r0, [r0]
31;CHECK: 	bl	foo
32;CHECK: 	pop	{r11, lr}
33;CHECK: 	mov	pc, lr
34
35
36;CHECK-LABEL: doFoo2:
37;CHECK: 	push	{r11, lr}
38;CHECK: 	ldr	r0,
39;CHECK: 	mov	r1, #0
40;CHECK: 	ldr	r0, [r0]
41;CHECK: 	mov	r2, r0
42;CHECK: 	bl	foo2
43;CHECK: 	pop	{r11, lr}
44;CHECK: 	mov	pc, lr
45
46
47%artz = type { i32 }
48@static_val = constant %artz { i32 777 }
49
50declare void @fooUseParam(%artz* )
51
52define void @foo(%artz* byval %s) {
53  call void @fooUseParam(%artz* %s)
54  ret void
55}
56
57define void @foo2(%artz* byval %s, i32 %p, %artz* byval %s2) {
58  call void @fooUseParam(%artz* %s)
59  call void @fooUseParam(%artz* %s2)
60  ret void
61}
62
63
64define void @doFoo() {
65  call void @foo(%artz* byval @static_val)
66  ret void
67}
68
69define void @doFoo2() {
70  call void @foo2(%artz* byval @static_val, i32 0, %artz* byval @static_val)
71  ret void
72}
73
74