1;; IR + Profile to split machine functions with -fsplit-machine-functions 2;; Source used to generate this file 3;; int k; 4 5;; int baz() { 6;; return 0; 7;; } 8;; 9;; int bar() { 10;; return 0; 11;; } 12;; 13;; int foo() { 14;; if (k) 15;; baz(); 16;; else 17;; bar(); 18;; return 0; 19;; } 20;; 21;; int main() { 22;; foo(); 23;; return 0; 24;; } 25 26;; Commands: 27;; clang -fprofile-generate -O0 source.cc 28;; ./a.out && llvm-profdata merge -o default.profdata *.profraw 29;; clang -fprofile-use -O0 source.cc -emit-llvm -S 30 31target triple = "x86_64-unknown-linux-gnu" 32 33@k = dso_local global i32 0, align 4 34 35define dso_local i32 @_Z3bazv() !prof !31 { 36 ret i32 0 37} 38 39define dso_local i32 @_Z3barv() !prof !32 { 40 ret i32 0 41} 42 43define dso_local i32 @_Z3foov() !prof !32 { 44 %1 = load i32, i32* @k, align 4 45 %2 = icmp ne i32 %1, 0 46 br i1 %2, label %3, label %5, !prof !33 47 483: ; preds = %0 49 %4 = call i32 @_Z3bazv() 50 br label %7 51 525: ; preds = %0 53 %6 = call i32 @_Z3barv() 54 br label %7 55 567: ; preds = %5, %3 57 ret i32 0 58} 59 60define dso_local i32 @main() !prof !32 { 61 %1 = call i32 @_Z3foov() 62 ret i32 0 63} 64 65!llvm.module.flags = !{!0, !1} 66 67!0 = !{i32 1, !"wchar_size", i32 4} 68!1 = !{i32 1, !"ProfileSummary", !2} 69!2 = !{!3, !4, !5, !6, !7, !8, !9, !10, !11, !12} 70!3 = !{!"ProfileFormat", !"InstrProf"} 71!4 = !{!"TotalCount", i64 3} 72!5 = !{!"MaxCount", i64 1} 73!6 = !{!"MaxInternalCount", i64 1} 74!7 = !{!"MaxFunctionCount", i64 1} 75!8 = !{!"NumCounts", i64 5} 76!9 = !{!"NumFunctions", i64 4} 77!10 = !{!"IsPartialProfile", i64 0} 78!11 = !{!"PartialProfileRatio", double 0.000000e+00} 79!12 = !{!"DetailedSummary", !13} 80!13 = !{!14, !15, !16, !17, !18, !19, !20, !21, !22, !23, !24, !25, !26, !27, !28, !29} 81!14 = !{i32 10000, i64 0, i32 0} 82!15 = !{i32 100000, i64 0, i32 0} 83!16 = !{i32 200000, i64 0, i32 0} 84!17 = !{i32 300000, i64 0, i32 0} 85!18 = !{i32 400000, i64 1, i32 3} 86!19 = !{i32 500000, i64 1, i32 3} 87!20 = !{i32 600000, i64 1, i32 3} 88!21 = !{i32 700000, i64 1, i32 3} 89!22 = !{i32 800000, i64 1, i32 3} 90!23 = !{i32 900000, i64 1, i32 3} 91!24 = !{i32 950000, i64 1, i32 3} 92!25 = !{i32 990000, i64 1, i32 3} 93!26 = !{i32 999000, i64 1, i32 3} 94!27 = !{i32 999900, i64 1, i32 3} 95!28 = !{i32 999990, i64 1, i32 3} 96!29 = !{i32 999999, i64 1, i32 3} 97!31 = !{!"function_entry_count", i64 0} 98!32 = !{!"function_entry_count", i64 1} 99!33 = !{!"branch_weights", i32 1, i32 0} 100