xref: /llvm-project/llvm/test/Transforms/CodeExtractor/cost_meta.ll (revision 5867241eacb750b0102df7645dc7036326cde38e)
10ca8ddd8SRoman Lebedev; RUN: opt -S < %s -passes=partial-inliner -partial-inlining-extra-penalty=2000 | FileCheck %s
2*5867241eSNikita Popovdefine i32 @outline_region_notlikely(ptr %arg) local_unnamed_addr {
3cee313d2SEric Christopherbb:
4cee313d2SEric Christopher;  ptr != null is predicted to be true
5*5867241eSNikita Popov  %tmp = icmp ne ptr %arg, null
6cee313d2SEric Christopher  br i1 %tmp, label %bb8, label %bb1, !prof !2
7cee313d2SEric Christopher
8cee313d2SEric Christopher; bb1 is not likely
9cee313d2SEric Christopherbb1:                                              ; preds = %bb
10*5867241eSNikita Popov  %tmp2 = tail call i32 @foo(ptr nonnull %arg)
11*5867241eSNikita Popov  %tmp3 = tail call i32 @foo(ptr nonnull %arg)
12*5867241eSNikita Popov  %tmp4 = tail call i32 @foo(ptr nonnull %arg)
13*5867241eSNikita Popov  %tmp5 = tail call i32 @foo(ptr nonnull %arg)
14*5867241eSNikita Popov  %tmp6 = tail call i32 @foo(ptr nonnull %arg)
15*5867241eSNikita Popov  %tmp7 = tail call i32 @foo(ptr nonnull %arg)
16cee313d2SEric Christopher  br label %bb8
17cee313d2SEric Christopher
18cee313d2SEric Christopherbb8:                                              ; preds = %bb1, %bb
19cee313d2SEric Christopher  %tmp9 = phi i32 [ 0, %bb1 ], [ 1, %bb ]
20cee313d2SEric Christopher  ret i32 %tmp9
21cee313d2SEric Christopher}
22cee313d2SEric Christopher
23*5867241eSNikita Popovdefine i32 @dummy_caller(ptr %arg) local_unnamed_addr {
24cee313d2SEric Christopher; CHECK-LABEL: @dummy_caller
25*5867241eSNikita Popov  %tmp = call i32 @outline_region_notlikely(ptr %arg)
26cee313d2SEric Christopher  ret i32 %tmp
27cee313d2SEric Christopher }
28cee313d2SEric Christopher
29cee313d2SEric Christopher
30*5867241eSNikita Popov; CHECK-LABEL: define internal void @outline_region_notlikely.1.bb1(ptr %arg) {
31cee313d2SEric Christopher; CHECK-NEXT: newFuncRoot:
32cee313d2SEric Christopher
33*5867241eSNikita Popovdeclare i32 @foo(ptr %arg)
34cee313d2SEric Christopher
35cee313d2SEric Christopher!llvm.module.flags = !{!0}
36cee313d2SEric Christopher!llvm.ident = !{!1}
37cee313d2SEric Christopher
38cee313d2SEric Christopher!0 = !{i32 1, !"wchar_size", i32 4}
39cee313d2SEric Christopher!1 = !{!"clang version 5.0.0 (trunk 304489)"}
40cee313d2SEric Christopher!2 = !{!"branch_weights", i32 2000, i32 1}
41