1cee313d2SEric Christopher; RUN: opt < %s -partial-inliner -max-num-inline-blocks=2 -skip-partial-inlining-cost-analysis -S | FileCheck %s
2cee313d2SEric Christopher
3cee313d2SEric Christopher; This test checks to make sure that CodeExtractor updates
4cee313d2SEric Christopher;  the exit branch probabilities for multiple exit blocks.
5cee313d2SEric Christopher
6cee313d2SEric Christopherdefine i32 @inlinedFunc(i1 %cond) !prof !1 {
7cee313d2SEric Christopherentry:
8cee313d2SEric Christopher  br i1 %cond, label %if.then, label %return, !prof !2
9cee313d2SEric Christopherif.then:
10cee313d2SEric Christopher  br i1 %cond, label %return, label %return.2, !prof !3
11cee313d2SEric Christopherreturn.2:
12cee313d2SEric Christopher  ret i32 10
13cee313d2SEric Christopherreturn:             ; preds = %entry
14cee313d2SEric Christopher  ret i32 0
15cee313d2SEric Christopher}
16cee313d2SEric Christopher
17cee313d2SEric Christopher
18cee313d2SEric Christopherdefine internal i32 @dummyCaller(i1 %cond) !prof !1 {
19cee313d2SEric Christopherentry:
20cee313d2SEric Christopher%val = call i32 @inlinedFunc(i1 %cond)
21cee313d2SEric Christopherret i32 %val
22cee313d2SEric Christopher
23cee313d2SEric Christopher; CHECK-LABEL: @dummyCaller
24cee313d2SEric Christopher; CHECK: call
25cee313d2SEric Christopher; CHECK-NEXT: br i1 {{.*}}return.i{{.*}}return.2{{.*}}!prof [[COUNT1:![0-9]+]]
26cee313d2SEric Christopher}
27cee313d2SEric Christopher
28cee313d2SEric Christopher!llvm.module.flags = !{!0}
29cee313d2SEric Christopher!0 = !{i32 1, !"MaxFunctionCount", i32 10000}
30cee313d2SEric Christopher!1 = !{!"function_entry_count", i64 10000}
31*5c31b8b9SArthur Eubanks!2 = !{!"branch_weights", i32 5, i32 5}
32*5c31b8b9SArthur Eubanks!3 = !{!"branch_weights", i32 4, i32 1}
33cee313d2SEric Christopher
34*5c31b8b9SArthur Eubanks; CHECK: [[COUNT1]] = !{!"branch_weights", i32 31, i32 8}
35