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