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. 3 4declare i8* @llvm.stacksave() #1 5declare void @llvm.stackrestore(i8*) #1 6 7; This function has a red zone. We shouldn't outline from it. 8; CHECK-LABEL: doggo 9; CHECK-NOT: OUTLINED 10define void @doggo(i32) #0 { 11 %2 = alloca i32, align 4 12 store i32 %0, i32* %2, align 4 13 %3 = load i32, i32* %2, align 4 14 %4 = add nsw i32 %3, 1 15 store i32 %4, i32* %2, align 4 16 ret void 17} 18 19; Ditto. 20; CHECK-LABEL: pupper 21; CHECK-NOT: OUTLINED 22define void @pupper(i32) #0 { 23 %2 = alloca i32, align 4 24 store i32 %0, i32* %2, align 4 25 %3 = load i32, i32* %2, align 4 26 %4 = add nsw i32 %3, 1 27 store i32 %4, i32* %2, align 4 28 ret void 29} 30 31; This doesn't have a redzone. Outlining is okay. 32; CHECK-LABEL: boofer 33; CHECK: OUTLINED 34define void @boofer(i32) #0 { 35 %2 = alloca i32, align 4 36 %3 = alloca i8*, align 8 37 %4 = alloca i64, align 8 38 store i32 %0, i32* %2, align 4 39 %5 = load i32, i32* %2, align 4 40 %6 = zext i32 %5 to i64 41 %7 = call i8* @llvm.stacksave() 42 store i8* %7, i8** %3, align 8 43 %8 = alloca i32, i64 %6, align 16 44 store i64 %6, i64* %4, align 8 45 %9 = load i8*, i8** %3, align 8 46 call void @llvm.stackrestore(i8* %9) 47 ret void 48} 49 50; Ditto. 51; CHECK-LABEL: shibe 52; CHECK: OUTLINED 53define void @shibe(i32) #0 { 54 %2 = alloca i32, align 4 55 %3 = alloca i8*, align 8 56 %4 = alloca i64, align 8 57 store i32 %0, i32* %2, align 4 58 %5 = load i32, i32* %2, align 4 59 %6 = zext i32 %5 to i64 60 %7 = call i8* @llvm.stacksave() 61 store i8* %7, i8** %3, align 8 62 %8 = alloca i32, i64 %6, align 16 63 store i64 %6, i64* %4, align 8 64 %9 = load i8*, i8** %3, align 8 65 call void @llvm.stackrestore(i8* %9) 66 ret void 67} 68 69attributes #0 = { noinline nounwind optnone ssp uwtable "no-frame-pointer-elim"="true" } 70attributes #1 = { nounwind }