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
468da426eSMehdi Amini; RUN: opt -module-summary %p/Inputs/thinlto-function-summary-callgraph.ll -o %t2.o
576a1c1d0STeresa Johnson; RUN: llvm-lto -thinlto -o %t3 %t.o %t2.o
676a1c1d0STeresa Johnson; RUN: llvm-bcanalyzer -dump %t3.thinlto.bc | FileCheck %s --check-prefix=COMBINED
776a1c1d0STeresa Johnson
876a1c1d0STeresa Johnson; CHECK:       <GLOBALVAL_SUMMARY_BLOCK
9*8fe6936eSMehdi Amini; CHECK-NEXT:    <VERSION
1076a1c1d0STeresa Johnson; See if the call to func is registered, using the expected callsite count
1176a1c1d0STeresa Johnson; and value id matching the subsequent value symbol table.
1276a1c1d0STeresa Johnson; CHECK-NEXT:    <PERMODULE {{.*}} op4=[[FUNCID:[0-9]+]] op5=1/>
1376a1c1d0STeresa Johnson; CHECK-NEXT:  </GLOBALVAL_SUMMARY_BLOCK>
1476a1c1d0STeresa Johnson; CHECK-NEXT:  <VALUE_SYMTAB
1576a1c1d0STeresa Johnson; CHECK-NEXT:    <FNENTRY {{.*}} record string = 'main'
1676a1c1d0STeresa Johnson; External function func should have entry with value id FUNCID
1776a1c1d0STeresa Johnson; CHECK-NEXT:    <ENTRY {{.*}} op0=[[FUNCID]] {{.*}} record string = 'func'
1876a1c1d0STeresa Johnson; CHECK-NEXT:  </VALUE_SYMTAB>
1976a1c1d0STeresa Johnson
2076a1c1d0STeresa Johnson; COMBINED:       <GLOBALVAL_SUMMARY_BLOCK
21*8fe6936eSMehdi Amini; COMBINED-NEXT:    <VERSION
2276a1c1d0STeresa Johnson; COMBINED-NEXT:    <COMBINED
2376a1c1d0STeresa Johnson; See if the call to func is registered, using the expected callsite count
2476a1c1d0STeresa Johnson; and value id matching the subsequent value symbol table.
2576a1c1d0STeresa Johnson; COMBINED-NEXT:    <COMBINED {{.*}} op4=[[FUNCID:[0-9]+]] op5=1/>
2676a1c1d0STeresa Johnson; COMBINED-NEXT:  </GLOBALVAL_SUMMARY_BLOCK>
2776a1c1d0STeresa Johnson; COMBINED-NEXT:  <VALUE_SYMTAB
2876a1c1d0STeresa Johnson; Entry for function func should have entry with value id FUNCID
2976a1c1d0STeresa Johnson; COMBINED-NEXT:    <COMBINED_GVDEFENTRY {{.*}} op0=[[FUNCID]] {{.*}} op2=7289175272376759421/>
3076a1c1d0STeresa Johnson; COMBINED-NEXT:    <COMBINED_GVDEFENTRY
3176a1c1d0STeresa Johnson; COMBINED-NEXT:  </VALUE_SYMTAB>
3276a1c1d0STeresa Johnson
3376a1c1d0STeresa Johnson; ModuleID = 'thinlto-function-summary-callgraph.ll'
3476a1c1d0STeresa Johnsontarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
3576a1c1d0STeresa Johnsontarget triple = "x86_64-unknown-linux-gnu"
3676a1c1d0STeresa Johnson
3776a1c1d0STeresa Johnson; Function Attrs: nounwind uwtable
3876a1c1d0STeresa Johnsondefine i32 @main() #0 {
3976a1c1d0STeresa Johnsonentry:
4076a1c1d0STeresa Johnson    call void (...) @func()
4176a1c1d0STeresa Johnson    ret i32 0
4276a1c1d0STeresa Johnson}
4376a1c1d0STeresa Johnson
4476a1c1d0STeresa Johnsondeclare void @func(...) #1
45