1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
4 ; Cold function, %dup should not be duplicated into predecessors.
5 define i32 @cold(i32 %a, ptr %p, ptr %q) !prof !21 {
7 ; CHECK: # %bb.0: # %entry
8 ; CHECK-NEXT: cmpl $2, %edi
9 ; CHECK-NEXT: jl .LBB0_2
10 ; CHECK-NEXT: # %bb.1: # %true1
11 ; CHECK-NEXT: movl (%rsi), %eax
12 ; CHECK-NEXT: addl $2, %eax
13 ; CHECK-NEXT: .LBB0_3: # %dup
14 ; CHECK-NEXT: cmpl $5, %eax
15 ; CHECK-NEXT: jl .LBB0_5
16 ; CHECK-NEXT: # %bb.4: # %true2
17 ; CHECK-NEXT: xorl %edi, %eax
19 ; CHECK-NEXT: .LBB0_2: # %false1
20 ; CHECK-NEXT: movl (%rdx), %eax
21 ; CHECK-NEXT: addl $-3, %eax
22 ; CHECK-NEXT: jmp .LBB0_3
23 ; CHECK-NEXT: .LBB0_5: # %false2
24 ; CHECK-NEXT: andl %edi, %eax
27 %cond1 = icmp sgt i32 %a, 1
28 br i1 %cond1, label %true1, label %false1, !prof !30
31 %v1 = load i32, ptr %p, align 4
36 %v3 = load i32, ptr %q, align 4
41 %v5 = phi i32 [%v2, %true1], [%v4, %false1]
42 %cond2 = icmp sgt i32 %v5, 4
43 br i1 %cond2, label %true2, label %false2, !prof !30
54 %v8 = phi i32 [%v6, %true2], [%v7, %false2]
58 ; Same code as previous function, but with hot profile count.
59 ; So %dup should be duplicated into predecessors.
60 define i32 @hot(i32 %a, ptr %p, ptr %q) !prof !22 {
62 ; CHECK: # %bb.0: # %entry
63 ; CHECK-NEXT: cmpl $2, %edi
64 ; CHECK-NEXT: jl .LBB1_2
65 ; CHECK-NEXT: # %bb.1: # %true1
66 ; CHECK-NEXT: movl (%rsi), %eax
67 ; CHECK-NEXT: addl $2, %eax
68 ; CHECK-NEXT: cmpl $5, %eax
69 ; CHECK-NEXT: jge .LBB1_4
70 ; CHECK-NEXT: .LBB1_5: # %false2
71 ; CHECK-NEXT: andl %edi, %eax
73 ; CHECK-NEXT: .LBB1_2: # %false1
74 ; CHECK-NEXT: movl (%rdx), %eax
75 ; CHECK-NEXT: addl $-3, %eax
76 ; CHECK-NEXT: cmpl $5, %eax
77 ; CHECK-NEXT: jl .LBB1_5
78 ; CHECK-NEXT: .LBB1_4: # %true2
79 ; CHECK-NEXT: xorl %edi, %eax
82 %cond1 = icmp sgt i32 %a, 1
83 br i1 %cond1, label %true1, label %false1, !prof !30
86 %v1 = load i32, ptr %p, align 4
91 %v3 = load i32, ptr %q, align 4
96 %v5 = phi i32 [%v2, %true1], [%v4, %false1]
97 %cond2 = icmp sgt i32 %v5, 4
98 br i1 %cond2, label %true2, label %false2, !prof !30
101 %v6 = xor i32 %v5, %a
105 %v7 = and i32 %v5, %a
109 %v8 = phi i32 [%v6, %true2], [%v7, %false2]
114 !llvm.module.flags = !{!1}
115 !21 = !{!"function_entry_count", i64 10}
116 !22 = !{!"function_entry_count", i64 400}
118 !30 = !{!"branch_weights", i32 1, i32 1}
120 !1 = !{i32 1, !"ProfileSummary", !2}
121 !2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
122 !3 = !{!"ProfileFormat", !"InstrProf"}
123 !4 = !{!"TotalCount", i64 10000}
124 !5 = !{!"MaxCount", i64 10}
125 !6 = !{!"MaxInternalCount", i64 1}
126 !7 = !{!"MaxFunctionCount", i64 1000}
127 !8 = !{!"NumCounts", i64 3}
128 !9 = !{!"NumFunctions", i64 3}
129 !10 = !{!"DetailedSummary", !11}
130 !11 = !{!12, !13, !14}
131 !12 = !{i32 10000, i64 100, i32 1}
132 !13 = !{i32 999000, i64 100, i32 1}
133 !14 = !{i32 999999, i64 1, i32 2}