13a0579f6SPiotr Padlewski; Test to check the callgraph in summary when there is PGO
23a0579f6SPiotr Padlewski; RUN: opt -module-summary %s -o %t.o
33a0579f6SPiotr Padlewski; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
4*d9830eb7SPiotr Padlewski
53a0579f6SPiotr Padlewski; RUN: opt -module-summary %p/Inputs/thinlto-function-summary-callgraph.ll -o %t2.o
63a0579f6SPiotr Padlewski; RUN: llvm-lto -thinlto -o %t3 %t.o %t2.o
73a0579f6SPiotr Padlewski; RUN: llvm-bcanalyzer -dump %t3.thinlto.bc | FileCheck %s --check-prefix=COMBINED
83a0579f6SPiotr Padlewski
9*d9830eb7SPiotr Padlewski; Check parsing for old summary versions generated from this file.
10*d9830eb7SPiotr Padlewski; RUN: llvm-lto -thinlto-index-stats %p/Inputs/thinlto-function-summary-callgraph-pgo.1.bc  | FileCheck %s --check-prefix=OLD
11*d9830eb7SPiotr Padlewski; RUN: llvm-lto -thinlto-index-stats %p/Inputs/thinlto-function-summary-callgraph-pgo-combined.1.bc  | FileCheck %s --check-prefix=OLD-COMBINED
12*d9830eb7SPiotr Padlewski
133a0579f6SPiotr Padlewski; CHECK:       <GLOBALVAL_SUMMARY_BLOCK
143a0579f6SPiotr Padlewski; CHECK-NEXT:    <VERSION
153a0579f6SPiotr Padlewski; See if the call to func is registered, using the expected callsite count
16*d9830eb7SPiotr Padlewski; and hotness type, with value id matching the subsequent value symbol table.
17*d9830eb7SPiotr Padlewski; CHECK-NEXT:    <PERMODULE_PROFILE {{.*}} op4=[[FUNCID:[0-9]+]] op5=2/>
183a0579f6SPiotr Padlewski; CHECK-NEXT:  </GLOBALVAL_SUMMARY_BLOCK>
193a0579f6SPiotr Padlewski; CHECK-NEXT:  <VALUE_SYMTAB
203a0579f6SPiotr Padlewski; CHECK-NEXT:    <FNENTRY {{.*}} record string = 'main'
213a0579f6SPiotr Padlewski; External function func should have entry with value id FUNCID
223a0579f6SPiotr Padlewski; CHECK-NEXT:    <ENTRY {{.*}} op0=[[FUNCID]] {{.*}} record string = 'func'
233a0579f6SPiotr Padlewski; CHECK-NEXT:  </VALUE_SYMTAB>
243a0579f6SPiotr Padlewski
253a0579f6SPiotr Padlewski; COMBINED:       <GLOBALVAL_SUMMARY_BLOCK
263a0579f6SPiotr Padlewski; COMBINED-NEXT:    <VERSION
273a0579f6SPiotr Padlewski; COMBINED-NEXT:    <COMBINED
283a0579f6SPiotr Padlewski; See if the call to func is registered, using the expected callsite count
29*d9830eb7SPiotr Padlewski; and hotness type, with value id matching the subsequent value symbol table.
30*d9830eb7SPiotr Padlewski; op6=2 which is hotnessType::None.
31*d9830eb7SPiotr Padlewski; COMBINED-NEXT:    <COMBINED_PROFILE {{.*}} op5=[[FUNCID:[0-9]+]] op6=2/>
323a0579f6SPiotr Padlewski; COMBINED-NEXT:  </GLOBALVAL_SUMMARY_BLOCK>
333a0579f6SPiotr Padlewski; COMBINED-NEXT:  <VALUE_SYMTAB
343a0579f6SPiotr Padlewski; Entry for function func should have entry with value id FUNCID
353a0579f6SPiotr Padlewski; COMBINED-NEXT:    <COMBINED_ENTRY {{.*}} op0=[[FUNCID]] op1=7289175272376759421/>
363a0579f6SPiotr Padlewski; COMBINED-NEXT:    <COMBINED
373a0579f6SPiotr Padlewski; COMBINED-NEXT:  </VALUE_SYMTAB>
383a0579f6SPiotr Padlewski
393a0579f6SPiotr Padlewski; ModuleID = 'thinlto-function-summary-callgraph.ll'
403a0579f6SPiotr Padlewskitarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
413a0579f6SPiotr Padlewskitarget triple = "x86_64-unknown-linux-gnu"
423a0579f6SPiotr Padlewski
433a0579f6SPiotr Padlewski; Function Attrs: nounwind uwtable
443a0579f6SPiotr Padlewskidefine i32 @main() #0 !prof !2 {
453a0579f6SPiotr Padlewskientry:
463a0579f6SPiotr Padlewski    call void (...) @func()
473a0579f6SPiotr Padlewski    ret i32 0
483a0579f6SPiotr Padlewski}
493a0579f6SPiotr Padlewski
503a0579f6SPiotr Padlewskideclare void @func(...) #1
513a0579f6SPiotr Padlewski
523a0579f6SPiotr Padlewski!2 = !{!"function_entry_count", i64 1}
53*d9830eb7SPiotr Padlewski
54*d9830eb7SPiotr Padlewski; OLD: Index {{.*}} contains 1 nodes (1 functions, 0 alias, 0 globals) and 1 edges (0 refs and 1 calls)
55*d9830eb7SPiotr Padlewski; OLD-COMBINED: Index {{.*}} contains 2 nodes (2 functions, 0 alias, 0 globals) and 1 edges (0 refs and 1 calls)
56