Use named temporaries for directional labels.
[oota-llvm.git] / test / Analysis / BlockFrequencyInfo / PR23525.ll
1 ; RUN: opt < %s -analyze -block-freq | FileCheck %s
2
3 @g = global i32 0, align 4
4
5 ; Function Attrs: inlinehint noinline nounwind uwtable
6 define i32 @_Z8hot_loopi(i32 %n) !prof !1 {
7 entry:
8   %div = sdiv i32 %n, 2
9   %rem12 = and i32 %n, 1
10   %cmp = icmp eq i32 %rem12, 0
11   br i1 %cmp, label %Next, label %for.cond, !prof !2
12
13 ; CHECK: - for.cond: float = 25.85{{[0-9]*}}, int = 206
14 for.cond:                                         ; preds = %entry, %for.inc
15   %i.0 = phi i32 [ %inc, %for.inc ], [ %div, %entry ]
16   %cmp1 = icmp slt i32 %i.0, %n
17   br i1 %cmp1, label %for.body, label %for.end, !prof !3, !llvm.loop !4
18
19 ; CHECK: - for.body: float = 24.52, int = 196
20 for.body:                                         ; preds = %for.cond
21   %rem213 = and i32 %i.0, 1
22   %cmp3 = icmp eq i32 %rem213, 0
23   br i1 %cmp3, label %if.then.4, label %Next, !prof !6
24
25 ; CHECK: - if.then.4: float = 12.26{{[0-9]*}}, int = 98
26 if.then.4:                                        ; preds = %for.body
27   %0 = load i32, i32* @g, align 4, !tbaa !7
28   %mul = shl nsw i32 %0, 1
29   br label %for.inc
30
31 ; CHECK: - Next: float = 12.41{{[0-9]*}}, int = 99
32 Next:                                             ; preds = %for.body, %entry
33   %i.1 = phi i32 [ %div, %entry ], [ %i.0, %for.body ]
34   %1 = load i32, i32* @g, align 4, !tbaa !7
35   %add = add nsw i32 %1, %n
36   br label %for.inc
37
38 ; CHECK: - for.inc: float = 38.28{{[0-9]*}}, int = 306
39 for.inc:                                          ; preds = %if.then.4, %Next
40   %storemerge = phi i32 [ %add, %Next ], [ %mul, %if.then.4 ]
41   %i.2 = phi i32 [ %i.1, %Next ], [ %i.0, %if.then.4 ]
42   store i32 %storemerge, i32* @g, align 4, !tbaa !7
43   %inc = add nsw i32 %i.2, 1
44   br label %for.cond
45
46 ; CHECK: - for.end: float = 1.0, int = 8
47 for.end:                                          ; preds = %for.cond
48   %2 = load i32, i32* @g, align 4, !tbaa !7
49   ret i32 %2
50 }
51
52 ; Function Attrs: nounwind uwtable
53 define i32 @main() !prof !11 {
54 entry:
55   br label %for.body
56
57 for.cond.cleanup:                                 ; preds = %for.body
58   ret i32 0
59
60 for.body:                                         ; preds = %for.body, %entry
61   %i.04 = phi i32 [ 1, %entry ], [ %inc, %for.body ]
62   %call = tail call i32 @_Z8hot_loopi(i32 %i.04)
63   %inc = add nuw nsw i32 %i.04, 1
64   %exitcond = icmp eq i32 %inc, 100
65   br i1 %exitcond, label %for.cond.cleanup, label %for.body, !prof !12
66 }
67
68
69 !1 = !{!"function_entry_count", i64 99}
70 !2 = !{!"branch_weights", i32 50, i32 51}
71 !3 = !{!"branch_weights", i32 2452, i32 100}
72 !4 = distinct !{!4, !5}
73 !5 = !{!"llvm.loop.unroll.disable"}
74 !6 = !{!"branch_weights", i32 1227, i32 1226}
75 !7 = !{!8, !8, i64 0}
76 !8 = !{!"int", !9, i64 0}
77 !9 = !{!"omnipotent char", !10, i64 0}
78 !10 = !{!"Simple C/C++ TBAA"}
79 !11 = !{!"function_entry_count", i64 1}
80 !12 = !{!"branch_weights", i32 2, i32 100}