1 ; RUN: opt -S -hotcoldsplit -hotcoldsplit-threshold=0 < %s | FileCheck %s
5 ; extern void sideeffect(int);
6 ; extern void __attribute__((cold)) sink();
8 ; if (cond) { //< Start outlining here.
18 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
19 target triple = "x86_64-apple-macosx10.14.0"
21 ; CHECK-LABEL: define {{.*}}@foo(
22 ; CHECK: br i1 {{.*}}, label %codeRepl, label %if.end2
23 ; CHECK-LABEL: codeRepl:
24 ; CHECK-NEXT: call void @foo.cold.1
25 ; CHECK-LABEL: if.end2:
26 ; CHECK: call void @sideeffect(i32 2)
27 define void @foo(i32 %cond) {
29 %cond.addr = alloca i32
30 store i32 %cond, i32* %cond.addr
31 %0 = load i32, i32* %cond.addr
32 %tobool = icmp ne i32 %0, 0
33 br i1 %tobool, label %if.then, label %if.end2
35 if.then: ; preds = %entry
36 %1 = load i32, i32* %cond.addr
37 %cmp = icmp sgt i32 %1, 10
38 br i1 %cmp, label %if.then1, label %if.else
40 if.then1: ; preds = %if.then
41 call void @sideeffect(i32 0)
44 if.else: ; preds = %if.then
45 call void @sideeffect(i32 1)
48 if.end: ; preds = %if.else, %if.then1
49 call void (...) @sink()
52 if.end2: ; preds = %entry
53 call void @sideeffect(i32 2)
57 ; CHECK-LABEL: define {{.*}}@foo.cold.1
58 ; CHECK: call {{.*}}@sideeffect
59 ; CHECK: call {{.*}}@sideeffect
60 ; CHECK: call {{.*}}@sink
62 declare void @sideeffect(i32)
64 declare void @sink(...) cold