|
1 | 1 | ; RUN: llc -disable-preheader-prot=true -disable-machine-licm -machine-sink-bfi=true -mtriple=x86_64-apple-darwin < %s | FileCheck %s -check-prefix=MSINK_BFI
|
2 | 2 | ; RUN: llc -disable-preheader-prot=true -disable-machine-licm -machine-sink-bfi=false -mtriple=x86_64-apple-darwin < %s | FileCheck %s -check-prefix=MSINK_NOBFI
|
| 3 | +; RUN: llc -disable-preheader-prot=true -disable-machine-licm -machine-sink-bfi=true -force-pgso -mtriple=x86_64-apple-darwin < %s | FileCheck %s -check-prefix=MSINK_NOBFI |
3 | 4 |
|
4 | 5 | ; Test that by changing BlockFrequencyInfo we change the order in which
|
5 | 6 | ; machine-sink looks for successor blocks. By not using BFI, both G and B
|
6 | 7 | ; have the same loop depth and no instructions is sinked - B is selected but
|
7 | 8 | ; can't be used as to avoid breaking a non profitable critical edge. By using
|
8 | 9 | ; BFI, "mul" is sinked into the less frequent block G.
|
9 |
| -define i32 @sink_freqinfo(i32 %a, i32 %b) nounwind uwtable ssp { |
| 10 | +define i32 @sink_freqinfo(i32 %a, i32 %b) nounwind uwtable ssp !prof !14 { |
10 | 11 | ; MSINK_BFI-LABEL: sink_freqinfo
|
11 | 12 | ; MSINK_BFI: jl
|
12 | 13 | ; MSINK_BFI-NEXT: ## %bb.
|
|
22 | 23 | %ee = phi i32 [ 0, %entry ], [ %inc, %F ]
|
23 | 24 | %xx = sub i32 %a, %ee
|
24 | 25 | %cond0 = icmp slt i32 %xx, 0
|
25 |
| - br i1 %cond0, label %F, label %exit, !prof !0 |
| 26 | + br i1 %cond0, label %F, label %exit, !prof !15 |
26 | 27 |
|
27 | 28 | F:
|
28 | 29 | %inc = add nsw i32 %xx, 2
|
29 | 30 | %aa = mul nsw i32 %b, %inc
|
30 | 31 | %exitcond = icmp slt i32 %inc, %a
|
31 |
| - br i1 %exitcond, label %B, label %G, !prof !1 |
| 32 | + br i1 %exitcond, label %B, label %G, !prof !16 |
32 | 33 |
|
33 | 34 | G:
|
34 | 35 | %ii = add nsw i32 %aa, %a
|
35 | 36 | %ll = add i32 %b, 45
|
36 | 37 | %exitcond2 = icmp sge i32 %ii, %b
|
37 |
| - br i1 %exitcond2, label %G, label %exit, !prof !2 |
| 38 | + br i1 %exitcond2, label %G, label %exit, !prof !17 |
38 | 39 |
|
39 | 40 | exit:
|
40 | 41 | ret i32 0
|
41 | 42 | }
|
42 | 43 |
|
43 |
| -!0 = !{!"branch_weights", i32 4, i32 1} |
44 |
| -!1 = !{!"branch_weights", i32 128, i32 1} |
45 |
| -!2 = !{!"branch_weights", i32 1, i32 1} |
| 44 | +!llvm.module.flags = !{!0} |
| 45 | +!0 = !{i32 1, !"ProfileSummary", !1} |
| 46 | +!1 = !{!2, !3, !4, !5, !6, !7, !8, !9} |
| 47 | +!2 = !{!"ProfileFormat", !"InstrProf"} |
| 48 | +!3 = !{!"TotalCount", i64 10000} |
| 49 | +!4 = !{!"MaxCount", i64 10} |
| 50 | +!5 = !{!"MaxInternalCount", i64 1} |
| 51 | +!6 = !{!"MaxFunctionCount", i64 1000} |
| 52 | +!7 = !{!"NumCounts", i64 3} |
| 53 | +!8 = !{!"NumFunctions", i64 3} |
| 54 | +!9 = !{!"DetailedSummary", !10} |
| 55 | +!10 = !{!11, !12, !13} |
| 56 | +!11 = !{i32 10000, i64 100, i32 1} |
| 57 | +!12 = !{i32 999000, i64 100, i32 1} |
| 58 | +!13 = !{i32 999999, i64 1, i32 2} |
| 59 | +!14 = !{!"function_entry_count", i64 1000} |
| 60 | +!15 = !{!"branch_weights", i32 4, i32 1} |
| 61 | +!16 = !{!"branch_weights", i32 128, i32 1} |
| 62 | +!17 = !{!"branch_weights", i32 1, i32 1} |
0 commit comments