1 ; RUN: opt -S -passes=hotcoldsplit -hotcoldsplit-threshold=0 < %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-LABEL: define {{.*}}@foo(
8 ; CHECK: sideeffect(i32 2)
9 define void @foo(i32 %cond) personality i8 0 {
11 invoke void @llvm.donothing() to label %normal unwind label %exception
14 ; Note: EH pads are not candidates for region entry points.
15 %cleanup = landingpad i8 cleanup
16 br label %continue_exception
19 call void @sideeffect(i32 0)
24 call void @sideeffect(i32 2)
28 ; See llvm.org/PR39917. It's currently not safe to outline landingpad
31 ; CHECK-LABEL: define {{.*}}@bar(
33 define void @bar(i32 %cond) personality i8 0 {
35 br i1 undef, label %exit, label %continue
41 invoke void @sink() to label %normal unwind label %exception
44 ; Note: EH pads are not candidates for region entry points.
45 %cleanup = landingpad i8 cleanup
46 br label %trivial-eh-handler
49 call void @sideeffect(i32 1)
53 call void @sideeffect(i32 0)
57 define void @baz() personality i8 0 {
59 br i1 undef, label %exit, label %cold1
65 ; The predecessor of a cold invoke may still be extracted (see baz.cold.2).
66 call void @sideeffect(i32 0)
70 invoke void @sink() to label %cold3 unwind label %cold4
73 ; The successor of a cold invoke may still be extracted (see baz.cold.1).
74 call void @sideeffect(i32 1)
82 ; CHECK-LABEL: define {{.*}}@foo.cold.1(
83 ; CHECK: sideeffect(i32 0)
86 ; CHECK-LABEL: define {{.*}}@bar.cold.1(
87 ; CHECK: sideeffect(i32 1)
89 ; CHECK-LABEL: define {{.*}}@baz.cold.1(
90 ; CHECK: sideeffect(i32 1)
92 ; CHECK-LABEL: define {{.*}}@baz.cold.2(
93 ; CHECK: sideeffect(i32 0)
95 declare void @sideeffect(i32)
97 declare void @sink() cold
99 declare void @llvm.donothing() nounwind readnone