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
4d9830eb7SPiotr 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
9d9830eb7SPiotr Padlewski; Check parsing for old summary versions generated from this file.
10d9830eb7SPiotr Padlewski; RUN: llvm-lto -thinlto-index-stats %p/Inputs/thinlto-function-summary-callgraph-pgo.1.bc  | FileCheck %s --check-prefix=OLD
11d9830eb7SPiotr Padlewski; RUN: llvm-lto -thinlto-index-stats %p/Inputs/thinlto-function-summary-callgraph-pgo-combined.1.bc  | FileCheck %s --check-prefix=OLD-COMBINED
12d9830eb7SPiotr Padlewski
13a0f371a1SPeter Collingbourne; CHECK: <SOURCE_FILENAME
14a0f371a1SPeter Collingbourne; CHECK-NEXT: <FUNCTION
15a0f371a1SPeter Collingbourne; "func"
16a0f371a1SPeter Collingbourne; CHECK-NEXT: <FUNCTION op0=4 op1=4
173a0579f6SPiotr Padlewski; CHECK:       <GLOBALVAL_SUMMARY_BLOCK
183a0579f6SPiotr Padlewski; CHECK-NEXT:    <VERSION
19290a8398STeresa Johnson; CHECK-NEXT:    <FLAGS
20a0f371a1SPeter Collingbourne; See if the call to func is registered, using the expected hotness type.
213aef3528SEugene Leviant; CHECK-NEXT:    <PERMODULE_PROFILE {{.*}} op7=1 op8=2/>
22*a7fa35a6SHiroshi Yamauchi; CHECK-NEXT:    <BLOCK_COUNT op0=1/>
233a0579f6SPiotr Padlewski; CHECK-NEXT:  </GLOBALVAL_SUMMARY_BLOCK>
24a0f371a1SPeter Collingbourne; CHECK: <STRTAB_BLOCK
2592648c25SPeter Collingbourne; CHECK-NEXT: blob data = 'mainfunc{{.*}}'
263a0579f6SPiotr Padlewski
273a0579f6SPiotr Padlewski; COMBINED:       <GLOBALVAL_SUMMARY_BLOCK
283a0579f6SPiotr Padlewski; COMBINED-NEXT:    <VERSION
29f3681015STeresa Johnson; COMBINED-NEXT:    <FLAGS
30a0f371a1SPeter Collingbourne; COMBINED-NEXT:    <VALUE_GUID op0=[[FUNCID:[0-9]+]] op1=7289175272376759421/>
31a0f371a1SPeter Collingbourne; COMBINED-NEXT:    <VALUE_GUID
323a0579f6SPiotr Padlewski; COMBINED-NEXT:    <COMBINED
33a0f371a1SPeter Collingbourne; See if the call to func is registered, using the expected hotness type.
34d9830eb7SPiotr Padlewski; op6=2 which is hotnessType::None.
353aef3528SEugene Leviant; COMBINED-NEXT:    <COMBINED_PROFILE {{.*}} op9=[[FUNCID]] op10=2/>
36*a7fa35a6SHiroshi Yamauchi; COMBINED-NEXT:    <BLOCK_COUNT op0=2/>
373a0579f6SPiotr Padlewski; COMBINED-NEXT:  </GLOBALVAL_SUMMARY_BLOCK>
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}
53d9830eb7SPiotr Padlewski
54d9830eb7SPiotr Padlewski; OLD: Index {{.*}} contains 1 nodes (1 functions, 0 alias, 0 globals) and 1 edges (0 refs and 1 calls)
55d9830eb7SPiotr Padlewski; OLD-COMBINED: Index {{.*}} contains 2 nodes (2 functions, 0 alias, 0 globals) and 1 edges (0 refs and 1 calls)
56