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