1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
3 ; Cold function, %dup should not be duplicated into predecessors.
4 define i32 @cold(i32 %a, ptr %p, ptr %q) !prof !21 {
13 %cond1 = icmp sgt i32 %a, 1
14 br i1 %cond1, label %true1, label %false1, !prof !30
17 %v1 = load i32, ptr %p, align 4
22 %v3 = load i32, ptr %q, align 4
27 %v5 = phi i32 [%v2, %true1], [%v4, %false1]
28 %cond2 = icmp sgt i32 %v5, 4
29 br i1 %cond2, label %true2, label %false2, !prof !30
40 %v8 = phi i32 [%v6, %true2], [%v7, %false2]
44 ; Same code as previous function, but with hot profile count.
45 ; So %dup should be duplicated into predecessors.
46 define i32 @hot(i32 %a, ptr %p, ptr %q) !prof !22 {
54 %cond1 = icmp sgt i32 %a, 1
55 br i1 %cond1, label %true1, label %false1, !prof !30
58 %v1 = load i32, ptr %p, align 4
63 %v3 = load i32, ptr %q, align 4
68 %v5 = phi i32 [%v2, %true1], [%v4, %false1]
69 %cond2 = icmp sgt i32 %v5, 4
70 br i1 %cond2, label %true2, label %false2, !prof !30
81 %v8 = phi i32 [%v6, %true2], [%v7, %false2]
86 !llvm.module.flags = !{!1}
87 !21 = !{!"function_entry_count", i64 10}
88 !22 = !{!"function_entry_count", i64 400}
90 !30 = !{!"branch_weights", i32 1, i32 1}
92 !1 = !{i32 1, !"ProfileSummary", !2}
93 !2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
94 !3 = !{!"ProfileFormat", !"InstrProf"}
95 !4 = !{!"TotalCount", i64 10000}
96 !5 = !{!"MaxCount", i64 10}
97 !6 = !{!"MaxInternalCount", i64 1}
98 !7 = !{!"MaxFunctionCount", i64 1000}
99 !8 = !{!"NumCounts", i64 3}
100 !9 = !{!"NumFunctions", i64 3}
101 !10 = !{!"DetailedSummary", !11}
102 !11 = !{!12, !13, !14}
103 !12 = !{i32 10000, i64 100, i32 1}
104 !13 = !{i32 999000, i64 100, i32 1}
105 !14 = !{i32 999999, i64 1, i32 2}