File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
llvm/test/Transforms/InstCombine Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ ; RUN: opt < %s -passes="print<branch-prob>,instcombine,print<branch-prob>" -S 2>&1 | FileCheck %s
2
+
3
+ ; CHECK: Printing analysis 'Branch Probability Analysis' for function 'invert_cond':
4
+ ; CHECK-NEXT: ---- Branch Probabilities ----
5
+ ; CHECK-NEXT: edge %entry -> %bb1 probability is 0x06186186 / 0x80000000 = 4.76%
6
+ ; CHECK-NEXT: edge %entry -> %bb2 probability is 0x79e79e7a / 0x80000000 = 95.24% [HOT edge]
7
+ ; CHECK-NEXT: Printing analysis 'Branch Probability Analysis' for function 'invert_cond':
8
+ ; CHECK-NEXT: ---- Branch Probabilities ----
9
+ ; CHECK-NEXT: edge %entry -> %bb2 probability is 0x06186186 / 0x80000000 = 4.76%
10
+ ; CHECK-NEXT: edge %entry -> %bb1 probability is 0x79e79e7a / 0x80000000 = 95.24% [HOT edge]
11
+
12
+ define i32 @invert_cond (ptr %p ) {
13
+ ; CHECK-LABEL: define i32 @invert_cond(
14
+ ; CHECK-SAME: ptr [[P:%.*]]) {
15
+ ; CHECK-NEXT: entry:
16
+ ; CHECK-NEXT: [[COND_NOT:%.*]] = icmp eq ptr [[P]], null
17
+ ; CHECK-NEXT: br i1 [[COND_NOT]], label [[BB2:%.*]], label [[BB1:%.*]], !prof [[PROF0:![0-9]+]]
18
+ ; CHECK: bb1:
19
+ ; CHECK-NEXT: ret i32 0
20
+ ; CHECK: bb2:
21
+ ; CHECK-NEXT: ret i32 1
22
+ ;
23
+ entry:
24
+ %cond = icmp ne ptr %p , null
25
+ br i1 %cond , label %bb1 , label %bb2 , !prof !1
26
+
27
+ bb1:
28
+ ret i32 0 ;
29
+
30
+ bb2:
31
+ ret i32 1 ;
32
+ }
33
+
34
+ !1 = !{!"branch_weights" , i32 1 , i32 20 }
35
+ ; CHECK: [[PROF0]] = !{!"branch_weights", i32 20, i32 1}
36
+
You can’t perform that action at this time.
0 commit comments