1; RUN: llc -mtriple x86_64-apple-macosx10.8.0 < %s 2>&1 >/dev/null | FileCheck %s
2; Check the internal option that warns when the stack frame size exceeds the
3; given amount.
4; <rdar://13987214>
5
6; CHECK-NOT: nowarn
7define void @nowarn() nounwind ssp "warn-stack-size"="80" {
8entry:
9  %buffer = alloca [12 x i8], align 1
10  call void @doit(ptr %buffer) nounwind
11  ret void
12}
13
14; CHECK: warning: stack frame size (88) exceeds limit (80) in function 'warn'
15define void @warn() nounwind ssp "warn-stack-size"="80" {
16entry:
17  %buffer = alloca [80 x i8], align 1
18  call void @doit(ptr %buffer) nounwind
19  ret void
20}
21
22; Ensure that warn-stack-size also considers the size of the unsafe stack.
23; With safestack enabled the machine stack size is well below 80, but the
24; combined stack size of the machine stack and unsafe stack will exceed the
25; warning threshold
26
27; CHECK: warning: stack frame size (120) exceeds limit (80) in function 'warn_safestack'
28define void @warn_safestack() nounwind ssp safestack "warn-stack-size"="80" {
29entry:
30  %buffer = alloca [80 x i8], align 1
31  call void @doit(ptr %buffer) nounwind
32  ret void
33}
34declare void @doit(ptr)
35