1 ; RUN: llc -enable-machine-outliner -mtriple=x86_64-apple-darwin < %s | FileCheck %s
2 ; Ensure that the outliner doesn't outline from any functions that use a redzone.
4 declare ptr @llvm.stacksave() #1
5 declare void @llvm.stackrestore(ptr) #1
7 ; This function has a red zone. We shouldn't outline from it.
10 define void @doggo(i32) #0 {
11 %2 = alloca i32, align 4
12 store i32 %0, ptr %2, align 4
13 %3 = load i32, ptr %2, align 4
14 %4 = add nsw i32 %3, 1
15 store i32 %4, ptr %2, align 4
22 define void @pupper(i32) #0 {
23 %2 = alloca i32, align 4
24 store i32 %0, ptr %2, align 4
25 %3 = load i32, ptr %2, align 4
26 %4 = add nsw i32 %3, 1
27 store i32 %4, ptr %2, align 4
31 ; This doesn't have a redzone. Outlining is okay.
34 define void @boofer(i32) #0 {
35 %2 = alloca i32, align 4
36 %3 = alloca ptr, align 8
37 %4 = alloca i64, align 8
38 store i32 %0, ptr %2, align 4
39 %5 = load i32, ptr %2, align 4
40 %6 = zext i32 %5 to i64
41 %7 = call ptr @llvm.stacksave()
42 store ptr %7, ptr %3, align 8
43 %8 = alloca i32, i64 %6, align 16
44 store i64 %6, ptr %4, align 8
45 %9 = load ptr, ptr %3, align 8
46 call void @llvm.stackrestore(ptr %9)
53 define void @shibe(i32) #0 {
54 %2 = alloca i32, align 4
55 %3 = alloca ptr, align 8
56 %4 = alloca i64, align 8
57 store i32 %0, ptr %2, align 4
58 %5 = load i32, ptr %2, align 4
59 %6 = zext i32 %5 to i64
60 %7 = call ptr @llvm.stacksave()
61 store ptr %7, ptr %3, align 8
62 %8 = alloca i32, i64 %6, align 16
63 store i64 %6, ptr %4, align 8
64 %9 = load ptr, ptr %3, align 8
65 call void @llvm.stackrestore(ptr %9)
69 attributes #0 = { noinline nounwind optnone ssp uwtable "frame-pointer"="all" }
70 attributes #1 = { nounwind }