1 ; RUN: opt -S -passes=hotcoldsplit -hotcoldsplit-threshold=2 < %s | FileCheck %s
3 target datalayout = "E-m:a-p:32:32-i64:64-n32"
4 target triple = "powerpc64-ibm-aix7.2.0.0"
6 define void @foo(i32 %cond, i32 %s0, i32 %s1) {
7 ; CHECK-LABEL: define {{.*}}@foo(
8 ; CHECK: br i1 {{.*}}, label %codeRepl, label %if.end2
9 ; CHECK-LABEL: codeRepl:
10 ; CHECK-NEXT: call void @foo.cold.1
11 ; CHECK-LABEL: if.end2:
12 ; CHECK: call void @sideeffect
15 %cond.addr = alloca i32
16 store i32 %cond, ptr %cond.addr
17 %0 = load i32, ptr %cond.addr
18 %tobool = icmp ne i32 %0, 0
19 br i1 %tobool, label %if.then, label %if.end2
21 if.then: ; preds = %entry
22 %1 = load i32, ptr %cond.addr
23 %cmp = icmp sgt i32 %1, 10
24 br i1 %cmp, label %if.then1, label %if.else
26 if.then1: ; preds = %if.then
27 call void @sideeffect(i32 0)
30 if.else: ; preds = %if.then
31 call void @sink(i32 %s0)
32 call void @sideeffect(i32 1)
35 if.end: ; preds = %if.else, %if.then1
36 call void @sink(i32 %0)
39 if.end2: ; preds = %entry
40 call void @sideeffect(i32 %s1)
44 ; CHECK-LABEL: define {{.*}}@foo.cold.1
45 ; CHECK: call {{.*}}@sink
46 ; CHECK: call {{.*}}@sideeffect
47 ; CHECK: call {{.*}}@sideeffect
48 ; CHECK: call {{.*}}@sink
50 declare void @sideeffect(i32)
52 declare void @sink(i32) cold