1; Test to check the callgraph in summary when there is PGO 2; RUN: opt -module-summary %s -o %t.o 3; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s 4; RUN: opt -module-summary %p/Inputs/thinlto-function-summary-callgraph-profile-summary.ll -o %t2.o 5; RUN: llvm-lto -thinlto -o %t3 %t.o %t2.o 6; RUN: llvm-bcanalyzer -dump %t3.thinlto.bc | FileCheck %s --check-prefix=COMBINED 7 8 9; CHECK-LABEL: <GLOBALVAL_SUMMARY_BLOCK 10; CHECK-NEXT: <VERSION 11; See if the call to func is registered, using the expected callsite count 12; and profile count, with value id matching the subsequent value symbol table. 13; CHECK-NEXT: <PERMODULE_PROFILE {{.*}} op4=[[HOT1:.*]] op5=3 op6=[[COLD:.*]] op7=1 op8=[[HOT2:.*]] op9=3 op10=[[NONE1:.*]] op11=2 op12=[[HOT3:.*]] op13=3 op14=[[NONE2:.*]] op15=2 op16=[[NONE3:.*]] op17=2 op18=[[LEGACY:.*]] op19=3/> 14; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK> 15; CHECK-LABEL: <VALUE_SYMTAB 16; CHECK-NEXT: <FNENTRY {{.*}} record string = 'hot_function 17; CHECK-DAG: <ENTRY abbrevid=6 op0=[[NONE1]] {{.*}} record string = 'none1' 18; CHECK-DAG: <ENTRY abbrevid=6 op0=[[COLD]] {{.*}} record string = 'cold' 19; CHECK-DAG: <ENTRY abbrevid=6 op0=[[NONE2]] {{.*}} record string = 'none2' 20; CHECK-DAG: <ENTRY abbrevid=6 op0=[[NONE3]] {{.*}} record string = 'none3' 21; CHECK-DAG: <ENTRY abbrevid=6 op0=[[HOT1]] {{.*}} record string = 'hot1' 22; CHECK-DAG: <ENTRY abbrevid=6 op0=[[HOT2]] {{.*}} record string = 'hot2' 23; CHECK-DAG: <ENTRY abbrevid=6 op0=[[HOT3]] {{.*}} record string = 'hot3' 24; CHECK-DAG: <COMBINED_ENTRY abbrevid=11 op0=[[LEGACY]] op1=123/> 25; CHECK-LABEL: </VALUE_SYMTAB> 26 27; COMBINED: <GLOBALVAL_SUMMARY_BLOCK 28; COMBINED-NEXT: <VERSION 29; COMBINED-NEXT: <COMBINED abbrevid= 30; COMBINED-NEXT: <COMBINED abbrevid= 31; COMBINED-NEXT: <COMBINED abbrevid= 32; COMBINED-NEXT: <COMBINED abbrevid= 33; COMBINED-NEXT: <COMBINED abbrevid= 34; COMBINED-NEXT: <COMBINED abbrevid= 35; COMBINED-NEXT: <COMBINED_PROFILE {{.*}} op5=[[HOT1:.*]] op6=3 op7=[[COLD:.*]] op8=1 op9=[[HOT2:.*]] op10=3 op11=[[NONE1:.*]] op12=2 op13=[[HOT3:.*]] op14=3 op15=[[NONE2:.*]] op16=2 op17=[[NONE3:.*]] op18=2/> 36; COMBINED_NEXT: <COMBINED abbrevid= 37; COMBINED_NEXT: </GLOBALVAL_SUMMARY_BLOCK> 38 39 40; ModuleID = 'thinlto-function-summary-callgraph.ll' 41target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 42target triple = "x86_64-unknown-linux-gnu" 43 44; This function have high profile count, so entry block is hot. 45define void @hot_function(i1 %a, i1 %a2) !prof !20 { 46entry: 47 call void @hot1() 48 br i1 %a, label %Cold, label %Hot, !prof !41 49Cold: ; 1/1000 goes here 50 call void @cold() 51 call void @hot2() 52 call void @none1() 53 br label %exit 54Hot: ; 999/1000 goes here 55 call void @hot2() 56 call void @hot3() 57 br i1 %a2, label %None1, label %None2, !prof !42 58None1: ; half goes here 59 call void @none1() 60 call void @none2() 61 br label %exit 62None2: ; half goes here 63 call void @none3() 64 br label %exit 65exit: 66 ret void 67} 68 69declare void @hot1() #1 70declare void @hot2() #1 71declare void @hot3() #1 72declare void @cold() #1 73declare void @none1() #1 74declare void @none2() #1 75declare void @none3() #1 76 77 78!41 = !{!"branch_weights", i32 1, i32 1000} 79!42 = !{!"branch_weights", i32 1, i32 1} 80 81 82 83!llvm.module.flags = !{!1} 84!20 = !{!"function_entry_count", i64 110, i64 123} 85 86!1 = !{i32 1, !"ProfileSummary", !2} 87!2 = !{!3, !4, !5, !6, !7, !8, !9, !10} 88!3 = !{!"ProfileFormat", !"InstrProf"} 89!4 = !{!"TotalCount", i64 10000} 90!5 = !{!"MaxCount", i64 10} 91!6 = !{!"MaxInternalCount", i64 1} 92!7 = !{!"MaxFunctionCount", i64 1000} 93!8 = !{!"NumCounts", i64 3} 94!9 = !{!"NumFunctions", i64 3} 95!10 = !{!"DetailedSummary", !11} 96!11 = !{!12, !13, !14} 97!12 = !{i32 10000, i64 100, i32 1} 98!13 = !{i32 999000, i64 100, i32 1} 99!14 = !{i32 999999, i64 1, i32 2} 100