xref: /llvm-project/llvm/test/Transforms/HotColdSplit/section-splitting-default.ll (revision 8ee638fd175245eff88d77e1607e478db237dd41)
1; RUN: opt -passes=hotcoldsplit -hotcoldsplit-threshold=-1 -pass-remarks=hotcoldsplit -enable-cold-section=true -S < %s 2>&1 | FileCheck %s
2
3; This test case is copied over from split-cold-2.ll, modified
4; to test the `-enable-cold-section` parameter in opt.
5; Make sure this compiles. This test used to fail with an invalid phi node: the
6; two predecessors were outlined and the SSA representation was invalid.
7
8; CHECK: remark: <unknown>:0:0: fun split cold code into fun.cold.1
9; CHECK-LABEL: @fun
10; CHECK: codeRepl:
11; CHECK-NEXT: call void @fun.cold.1
12
13; CHECK: define {{.*}}@fun.cold.1{{.*}} [[cold_attr:#[0-9]+]] section "__llvm_cold"
14; CHECK: attributes [[cold_attr]] = { {{.*}}noreturn
15
16define void @fun(i1 %arg) {
17entry:
18  br i1 %arg, label %if.then, label %if.else
19
20if.then:
21  ret void
22
23if.else:
24  br label %if.then4
25
26if.then4:
27  br i1 %arg, label %if.then5, label %if.end
28
29if.then5:
30  br label %cleanup
31
32if.end:
33  br label %cleanup
34
35cleanup:
36  %cleanup.dest.slot.0 = phi i32 [ 1, %if.then5 ], [ 0, %if.end ]
37  unreachable
38}
39