1; rdar://8465407
2; RUN: llc < %s -mtriple=thumbv7-apple-ios -arm-atomic-cfg-tidy=0 | FileCheck %s
3
4%struct.buf = type opaque
5
6declare void @bar() nounwind optsize
7
8define void @foo() nounwind optsize {
9; CHECK-LABEL: foo:
10; CHECK: push
11; CHECK: mov r7, sp
12; CHECK: sub sp, #4
13entry:
14  %m.i = alloca %struct.buf*, align 4
15  br label %bb
16
17bb:
18  br i1 undef, label %bb3, label %bb2
19
20bb2:
21  call void @bar() nounwind optsize
22  br i1 undef, label %bb, label %bb3
23
24bb3:
25  br i1 undef, label %return, label %bb
26
27return:
28; CHECK: %return
29; 'mov sp, r7' would have left sp in an invalid state
30; CHECK-NOT: mov sp, r7
31; CHECK-NOT: sub, sp, #4
32; CHECK: add sp, #4
33  ret void
34}
35