1 ; RUN: opt -hotcoldsplit -hotcoldsplit-threshold=2 -S < %s | FileCheck %s
3 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-apple-macosx10.14.0"
6 ; Check that these functions are not split. Outlined functions are called from a
7 ; basic block named codeRepl.
9 ; The cold region is too small to split.
11 ; CHECK-NOT: foo.cold.1
14 br i1 undef, label %if.then, label %if.end
16 if.then: ; preds = %entry
19 if.end: ; preds = %entry
23 ; The cold region is still too small to split.
25 ; CHECK-NOT: bar.cold.1
28 br i1 undef, label %if.then, label %if.end
30 if.then: ; preds = %entry
34 if.end: ; preds = %entry
38 ; Make sure we don't try to outline the entire function.
40 ; CHECK-NOT: fun.cold.1
43 br i1 undef, label %if.then, label %if.end
45 if.then: ; preds = %entry
49 if.end: ; preds = %entry
53 ; Do not split `noinline` functions.
54 ; CHECK-LABEL: @noinline_func
55 ; CHECK-NOT: noinline_func.cold.1
56 define void @noinline_func() noinline {
58 br i1 undef, label %if.then, label %if.end
60 if.then: ; preds = %entry
64 if.end: ; preds = %entry
68 ; Do not split `alwaysinline` functions.
69 ; CHECK-LABEL: @alwaysinline_func
70 ; CHECK-NOT: alwaysinline_func.cold.1
71 define void @alwaysinline_func() alwaysinline {
73 br i1 undef, label %if.then, label %if.end
75 if.then: ; preds = %entry
79 if.end: ; preds = %entry
83 ; Don't outline infinite loops.
84 ; CHECK-LABEL: @infinite_loop
85 ; CHECK-NOT: infinite_loop.cold.1
86 define void @infinite_loop() {
95 ; Don't count debug intrinsics towards the outlining threshold.
96 ; CHECK-LABEL: @dont_count_debug_intrinsics
97 ; CHECK-NOT: dont_count_debug_intrinsics.cold.1
98 define void @dont_count_debug_intrinsics(i32 %arg1) !dbg !6 {
100 %var = add i32 0, 0, !dbg !11
101 br i1 undef, label %if.then, label %if.end
103 if.then: ; preds = %entry
106 if.end: ; preds = %entry
107 call void @llvm.dbg.value(metadata i32 %arg1, metadata !9, metadata !DIExpression()), !dbg !11
108 call void @llvm.dbg.value(metadata i32 %arg1, metadata !9, metadata !DIExpression()), !dbg !11
113 ; CHECK-LABEL: @sanitize_address
114 ; CHECK-NOT: sanitize_address.cold.1
115 define void @sanitize_address() sanitize_address {
117 br i1 undef, label %if.then, label %if.end
119 if.then: ; preds = %entry
123 if.end: ; preds = %entry
127 ; CHECK-LABEL: @sanitize_hwaddress
128 ; CHECK-NOT: sanitize_hwaddress.cold.1
129 define void @sanitize_hwaddress() sanitize_hwaddress {
131 br i1 undef, label %if.then, label %if.end
133 if.then: ; preds = %entry
137 if.end: ; preds = %entry
141 ; CHECK-LABEL: @sanitize_thread
142 ; CHECK-NOT: sanitize_thread.cold.1
143 define void @sanitize_thread() sanitize_thread {
145 br i1 undef, label %if.then, label %if.end
147 if.then: ; preds = %entry
151 if.end: ; preds = %entry
155 ; CHECK-LABEL: @sanitize_memory
156 ; CHECK-NOT: sanitize_memory.cold.1
157 define void @sanitize_memory() sanitize_memory {
159 br i1 undef, label %if.then, label %if.end
161 if.then: ; preds = %entry
165 if.end: ; preds = %entry
169 declare void @llvm.trap() cold noreturn
171 ; CHECK-LABEL: @nosanitize_call
172 ; CHECK-NOT: nosanitize_call.cold.1
173 define void @nosanitize_call() sanitize_memory {
175 br i1 undef, label %if.then, label %if.end
177 if.then: ; preds = %entry
178 call void @llvm.trap(), !nosanitize !2
181 if.end: ; preds = %entry
185 declare void @llvm.dbg.value(metadata, metadata, metadata)
187 declare void @sink() cold
190 !llvm.debugify = !{!3, !4}
191 !llvm.module.flags = !{!5}
193 !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
194 !1 = !DIFile(filename: "<stdin>", directory: "/")
198 !5 = !{i32 2, !"Debug Info Version", i32 3}
199 !6 = distinct !DISubprogram(name: "dont_count_debug_intrinsics", linkageName: "dont_count_debug_intrinsics", scope: null, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0, retainedNodes: !8)
200 !7 = !DISubroutineType(types: !2)
202 !9 = !DILocalVariable(name: "1", scope: !6, file: !1, line: 1, type: !10)
203 !10 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)
204 !11 = !DILocation(line: 1, column: 1, scope: !6)