176a1c1d0STeresa Johnson; Test to check the callgraph in summary
268da426eSMehdi Amini; RUN: opt -module-summary %s -o %t.o
376a1c1d0STeresa Johnson; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
4*d9830eb7SPiotr Padlewski
568da426eSMehdi Amini; RUN: opt -module-summary %p/Inputs/thinlto-function-summary-callgraph.ll -o %t2.o
676a1c1d0STeresa Johnson; RUN: llvm-lto -thinlto -o %t3 %t.o %t2.o
776a1c1d0STeresa Johnson; RUN: llvm-bcanalyzer -dump %t3.thinlto.bc | FileCheck %s --check-prefix=COMBINED
876a1c1d0STeresa Johnson
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.1.bc  | FileCheck %s --check-prefix=OLD
11*d9830eb7SPiotr Padlewski; RUN: llvm-lto -thinlto-index-stats %p/Inputs/thinlto-function-summary-callgraph-combined.1.bc  | FileCheck %s --check-prefix=OLD-COMBINED
12*d9830eb7SPiotr Padlewski
1376a1c1d0STeresa Johnson; CHECK:       <GLOBALVAL_SUMMARY_BLOCK
148fe6936eSMehdi Amini; CHECK-NEXT:    <VERSION
1576a1c1d0STeresa Johnson; See if the call to func is registered, using the expected callsite count
1676a1c1d0STeresa Johnson; and value id matching the subsequent value symbol table.
17*d9830eb7SPiotr Padlewski; CHECK-NEXT:    <PERMODULE {{.*}} op4=[[FUNCID:[0-9]+]]/>
1876a1c1d0STeresa Johnson; CHECK-NEXT:  </GLOBALVAL_SUMMARY_BLOCK>
1976a1c1d0STeresa Johnson; CHECK-NEXT:  <VALUE_SYMTAB
2076a1c1d0STeresa Johnson; CHECK-NEXT:    <FNENTRY {{.*}} record string = 'main'
2176a1c1d0STeresa Johnson; External function func should have entry with value id FUNCID
2276a1c1d0STeresa Johnson; CHECK-NEXT:    <ENTRY {{.*}} op0=[[FUNCID]] {{.*}} record string = 'func'
2376a1c1d0STeresa Johnson; CHECK-NEXT:  </VALUE_SYMTAB>
2476a1c1d0STeresa Johnson
2576a1c1d0STeresa Johnson; COMBINED:       <GLOBALVAL_SUMMARY_BLOCK
268fe6936eSMehdi Amini; COMBINED-NEXT:    <VERSION
2776a1c1d0STeresa Johnson; COMBINED-NEXT:    <COMBINED
2876a1c1d0STeresa Johnson; See if the call to func is registered, using the expected callsite count
2976a1c1d0STeresa Johnson; and value id matching the subsequent value symbol table.
30*d9830eb7SPiotr Padlewski; COMBINED-NEXT:    <COMBINED {{.*}} op5=[[FUNCID:[0-9]+]]/>
3176a1c1d0STeresa Johnson; COMBINED-NEXT:  </GLOBALVAL_SUMMARY_BLOCK>
3276a1c1d0STeresa Johnson; COMBINED-NEXT:  <VALUE_SYMTAB
3376a1c1d0STeresa Johnson; Entry for function func should have entry with value id FUNCID
3402e98331STeresa Johnson; COMBINED-NEXT:    <COMBINED_ENTRY {{.*}} op0=[[FUNCID]] op1=7289175272376759421/>
3502e98331STeresa Johnson; COMBINED-NEXT:    <COMBINED
3676a1c1d0STeresa Johnson; COMBINED-NEXT:  </VALUE_SYMTAB>
3776a1c1d0STeresa Johnson
3876a1c1d0STeresa Johnson; ModuleID = 'thinlto-function-summary-callgraph.ll'
3976a1c1d0STeresa Johnsontarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4076a1c1d0STeresa Johnsontarget triple = "x86_64-unknown-linux-gnu"
4176a1c1d0STeresa Johnson
4276a1c1d0STeresa Johnson; Function Attrs: nounwind uwtable
4376a1c1d0STeresa Johnsondefine i32 @main() #0 {
4476a1c1d0STeresa Johnsonentry:
4576a1c1d0STeresa Johnson    call void (...) @func()
4676a1c1d0STeresa Johnson    ret i32 0
4776a1c1d0STeresa Johnson}
4876a1c1d0STeresa Johnson
4976a1c1d0STeresa Johnsondeclare void @func(...) #1
50*d9830eb7SPiotr Padlewski
51*d9830eb7SPiotr Padlewski; OLD: Index {{.*}} contains 1 nodes (1 functions, 0 alias, 0 globals) and 1 edges (0 refs and 1 calls)
52*d9830eb7SPiotr Padlewski; OLD-COMBINED: Index {{.*}} contains 2 nodes (2 functions, 0 alias, 0 globals) and 1 edges (0 refs and 1 calls)