1 ; RUN: opt -hotcoldsplit -hotcoldsplit-threshold=0 -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 %struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
7 %struct.__sigset_t = type { [16 x i64] }
9 ; Don't outline noreturn calls which aren't explicitly marked cold.
11 ; CHECK-LABEL: define {{.*}}@foo(
12 ; CHECK-NOT: foo.cold.1
13 define void @foo(i32, %struct.__jmp_buf_tag*) {
14 %3 = icmp eq i32 %0, 0
15 tail call void @_Z10sideeffectv()
16 br i1 %3, label %5, label %4
18 ; <label>:4: ; preds = %2
19 tail call void @longjmp(%struct.__jmp_buf_tag* %1, i32 0)
22 ; <label>:5: ; preds = %2
26 ; Do outline noreturn calls marked cold.
28 ; CHECK-LABEL: define {{.*}}@bar(
29 ; CHECK: call {{.*}}@bar.cold.1(
30 define void @bar(i32) {
31 %2 = icmp eq i32 %0, 0
32 tail call void @_Z10sideeffectv()
33 br i1 %2, label %sink, label %exit
36 tail call void @_Z10sideeffectv()
37 call void @llvm.trap()
44 ; Do outline noreturn calls preceded by a cold call.
46 ; CHECK-LABEL: define {{.*}}@baz(
47 ; CHECK: call {{.*}}@baz.cold.1(
48 define void @baz(i32, %struct.__jmp_buf_tag*) {
49 %3 = icmp eq i32 %0, 0
50 tail call void @_Z10sideeffectv()
51 br i1 %3, label %5, label %4
53 ; <label>:4: ; preds = %2
55 tail call void @longjmp(%struct.__jmp_buf_tag* %1, i32 0)
58 ; <label>:5: ; preds = %2
62 ; CHECK-LABEL: define {{.*}}@bar.cold.1(
63 ; CHECK: call {{.*}}@llvm.trap(
65 declare void @sink() cold
67 declare void @llvm.trap() noreturn cold
69 declare void @_Z10sideeffectv()
71 declare void @longjmp(%struct.__jmp_buf_tag*, i32) noreturn nounwind