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
19a0f371a1SPeter Collingbourne; See if the call to func is registered, using the expected hotness type.
20*75da10d1SCharles Saternos; CHECK-NEXT:    <PERMODULE_PROFILE {{.*}} op5=1 op6=2/>
213a0579f6SPiotr Padlewski; CHECK-NEXT:  </GLOBALVAL_SUMMARY_BLOCK>
22a0f371a1SPeter Collingbourne; CHECK: <STRTAB_BLOCK
2392648c25SPeter Collingbourne; CHECK-NEXT: blob data = 'mainfunc{{.*}}'
243a0579f6SPiotr Padlewski
253a0579f6SPiotr Padlewski; COMBINED:       <GLOBALVAL_SUMMARY_BLOCK
263a0579f6SPiotr Padlewski; COMBINED-NEXT:    <VERSION
27a0f371a1SPeter Collingbourne; COMBINED-NEXT:    <VALUE_GUID op0=[[FUNCID:[0-9]+]] op1=7289175272376759421/>
28a0f371a1SPeter Collingbourne; COMBINED-NEXT:    <VALUE_GUID
293a0579f6SPiotr Padlewski; COMBINED-NEXT:    <COMBINED
30a0f371a1SPeter Collingbourne; See if the call to func is registered, using the expected hotness type.
31d9830eb7SPiotr Padlewski; op6=2 which is hotnessType::None.
32*75da10d1SCharles Saternos; COMBINED-NEXT:    <COMBINED_PROFILE {{.*}} op6=[[FUNCID]] op7=2/>
333a0579f6SPiotr Padlewski; COMBINED-NEXT:  </GLOBALVAL_SUMMARY_BLOCK>
343a0579f6SPiotr Padlewski
353a0579f6SPiotr Padlewski; ModuleID = 'thinlto-function-summary-callgraph.ll'
363a0579f6SPiotr Padlewskitarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
373a0579f6SPiotr Padlewskitarget triple = "x86_64-unknown-linux-gnu"
383a0579f6SPiotr Padlewski
393a0579f6SPiotr Padlewski; Function Attrs: nounwind uwtable
403a0579f6SPiotr Padlewskidefine i32 @main() #0 !prof !2 {
413a0579f6SPiotr Padlewskientry:
423a0579f6SPiotr Padlewski    call void (...) @func()
433a0579f6SPiotr Padlewski    ret i32 0
443a0579f6SPiotr Padlewski}
453a0579f6SPiotr Padlewski
463a0579f6SPiotr Padlewskideclare void @func(...) #1
473a0579f6SPiotr Padlewski
483a0579f6SPiotr Padlewski!2 = !{!"function_entry_count", i64 1}
49d9830eb7SPiotr Padlewski
50d9830eb7SPiotr Padlewski; OLD: Index {{.*}} contains 1 nodes (1 functions, 0 alias, 0 globals) and 1 edges (0 refs and 1 calls)
51d9830eb7SPiotr Padlewski; OLD-COMBINED: Index {{.*}} contains 2 nodes (2 functions, 0 alias, 0 globals) and 1 edges (0 refs and 1 calls)
52