1 ; RUN: opt -S -passes=hotcoldsplit -hotcoldsplit-threshold=0 < %s | FileCheck %s
5 ; extern __attribute__((cold)) void sink();
6 ; extern void sideeffect(int);
7 ; void foo(int cond1, int cond2) {
10 ; sideeffect(0); // This is cold (it reaches sink()).
14 ; sideeffect(1); // This is cold (it reaches sink()).
24 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
25 target triple = "x86_64-apple-macosx10.14.0"
27 ; CHECK-LABEL: define {{.*}}@_Z3fooii.cold.1
28 ; CHECK: call void @_Z10sideeffecti(i32 1)
30 ; CHECK-LABEL: define {{.*}}@_Z3fooii.cold.2
31 ; CHECK: call void @_Z10sideeffecti(i32 0)
33 ; CHECK-LABEL: define {{.*}}@_Z3fooii.cold.3
34 ; CHECK: call void @_Z4sinkv
35 ; CHECK: call void @_Z10sideeffecti(i32 3)
37 define void @_Z3fooii(i32, i32) {
38 %3 = alloca i32, align 4
39 %4 = alloca i32, align 4
40 store i32 %0, ptr %3, align 4
41 store i32 %1, ptr %4, align 4
44 ; <label>:5: ; preds = %2
45 %6 = load i32, ptr %3, align 4
46 %7 = icmp ne i32 %6, 0
47 br i1 %7, label %8, label %9
49 ; <label>:8: ; preds = %5
50 call void @_Z10sideeffecti(i32 0)
53 ; <label>:9: ; preds = %5
54 %10 = load i32, ptr %4, align 4
55 %11 = icmp ne i32 %10, 0
56 br i1 %11, label %12, label %13
58 ; <label>:12: ; preds = %9
59 call void @_Z10sideeffecti(i32 1)
62 ; <label>:13: ; preds = %9
63 call void @_Z10sideeffecti(i32 2)
66 ; <label>:14: ; preds = %12, %8
67 call void @_Z4sinkv() #3
68 call void @_Z10sideeffecti(i32 3)
71 ; <label>:15: ; preds = %14, %13
75 declare void @_Z10sideeffecti(i32)
77 declare void @_Z4sinkv() cold