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