OSDN Git Service

Even if we don't have 7 bytes of stack space we may need to save and
[android-x86/external-llvm.git] / test / CodeGen / ARM / thumb1-varalloc.ll
1 ; RUN: llc < %s -mtriple=thumbv6-apple-darwin | FileCheck %s
2 ; rdar://8819685
3
4 @__bar = external hidden global i8*
5 @__baz = external hidden global i8*
6
7 define i8* @_foo() {
8 entry:
9 ; CHECK: foo:
10
11         %size = alloca i32, align 4
12         %0 = load i8** @__bar, align 4
13         %1 = icmp eq i8* %0, null
14         br i1 %1, label %bb1, label %bb3
15                 
16 bb1:
17         store i32 1026, i32* %size, align 4
18         %2 = alloca [1026 x i8], align 1
19 ; CHECK: mov     r0, sp
20 ; CHECK: adds    r4, r0, r4
21         %3 = getelementptr inbounds [1026 x i8]* %2, i32 0, i32 0
22         %4 = call i32 @_called_func(i8* %3, i32* %size) nounwind
23         %5 = icmp eq i32 %4, 0
24         br i1 %5, label %bb2, label %bb3
25         
26 bb2:
27         %6 = call i8* @strdup(i8* %3) nounwind
28         store i8* %6, i8** @__baz, align 4
29         br label %bb3
30         
31 bb3:
32         %.0 = phi i8* [ %0, %entry ], [ %6, %bb2 ], [ %3, %bb1 ]
33 ; CHECK: subs    r4, #5
34 ; CHECK-NEXT: mov     sp, r4
35 ; CHECK-NEXT: pop     {r4, r5, r6, r7, pc}
36         ret i8* %.0
37 }
38
39 declare noalias i8* @strdup(i8* nocapture) nounwind
40 declare i32 @_called_func(i8*, i32*) nounwind