xref: /llvm-project/llvm/test/Transforms/JumpThreading/thread-prob-4.ll (revision a1b78fb929fccf96acaa0212cf68fee82298e747)
1; RUN: opt -debug-only=branch-prob -passes="require<branch-prob>,jump-threading" -S %s 2>&1 | FileCheck %s
2; RUN: opt -debug-only=branch-prob -passes=jump-threading -S %s 2>&1 | FileCheck %s --check-prefix=CHECK-NOBPI
3; REQUIRES: asserts
4
5; Make sure that we clear edge probabilities for bb1 as we fold
6; the conditional branch in it.
7
8; CHECK: eraseBlock bb1
9; CHECK-NOBPI-NOT: eraseBlock bb1
10
11define i32 @foo(i32 %arg) !prof !0 {
12; CHECK-LABEL: @foo
13  %cond1 = icmp eq i32 %arg, 42
14  br i1 %cond1, label %bb1, label %bb2
15
16bb2:
17  ret i32 2
18
19bb1:
20  %cond2 = icmp eq i32 %arg, 42
21  br i1 %cond2, label %bb3, label %bb4
22
23bb3:
24  ret i32 3
25
26bb4:
27; CHECK-NOT: bb4:
28  ret i32 4
29}
30
31!0 = !{!"function_entry_count", i64 0}
32