1*76a1c1d0STeresa Johnson; Test to check the callgraph in summary
2*76a1c1d0STeresa Johnson; RUN: llvm-as -function-summary %s -o %t.o
3*76a1c1d0STeresa Johnson; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
4*76a1c1d0STeresa Johnson; RUN: llvm-as -function-summary %p/Inputs/thinlto-function-summary-callgraph.ll -o %t2.o
5*76a1c1d0STeresa Johnson; RUN: llvm-lto -thinlto -o %t3 %t.o %t2.o
6*76a1c1d0STeresa Johnson; RUN: llvm-bcanalyzer -dump %t3.thinlto.bc | FileCheck %s --check-prefix=COMBINED
7*76a1c1d0STeresa Johnson
8*76a1c1d0STeresa Johnson; CHECK:       <GLOBALVAL_SUMMARY_BLOCK
9*76a1c1d0STeresa Johnson; See if the call to func is registered, using the expected callsite count
10*76a1c1d0STeresa Johnson; and value id matching the subsequent value symbol table.
11*76a1c1d0STeresa Johnson; CHECK-NEXT:    <PERMODULE {{.*}} op4=[[FUNCID:[0-9]+]] op5=1/>
12*76a1c1d0STeresa Johnson; CHECK-NEXT:  </GLOBALVAL_SUMMARY_BLOCK>
13*76a1c1d0STeresa Johnson; CHECK-NEXT:  <VALUE_SYMTAB
14*76a1c1d0STeresa Johnson; CHECK-NEXT:    <FNENTRY {{.*}} record string = 'main'
15*76a1c1d0STeresa Johnson; External function func should have entry with value id FUNCID
16*76a1c1d0STeresa Johnson; CHECK-NEXT:    <ENTRY {{.*}} op0=[[FUNCID]] {{.*}} record string = 'func'
17*76a1c1d0STeresa Johnson; CHECK-NEXT:  </VALUE_SYMTAB>
18*76a1c1d0STeresa Johnson
19*76a1c1d0STeresa Johnson; COMBINED:       <GLOBALVAL_SUMMARY_BLOCK
20*76a1c1d0STeresa Johnson; COMBINED-NEXT:    <COMBINED
21*76a1c1d0STeresa Johnson; See if the call to func is registered, using the expected callsite count
22*76a1c1d0STeresa Johnson; and value id matching the subsequent value symbol table.
23*76a1c1d0STeresa Johnson; COMBINED-NEXT:    <COMBINED {{.*}} op4=[[FUNCID:[0-9]+]] op5=1/>
24*76a1c1d0STeresa Johnson; COMBINED-NEXT:  </GLOBALVAL_SUMMARY_BLOCK>
25*76a1c1d0STeresa Johnson; COMBINED-NEXT:  <VALUE_SYMTAB
26*76a1c1d0STeresa Johnson; Entry for function func should have entry with value id FUNCID
27*76a1c1d0STeresa Johnson; COMBINED-NEXT:    <COMBINED_GVDEFENTRY {{.*}} op0=[[FUNCID]] {{.*}} op2=7289175272376759421/>
28*76a1c1d0STeresa Johnson; COMBINED-NEXT:    <COMBINED_GVDEFENTRY
29*76a1c1d0STeresa Johnson; COMBINED-NEXT:  </VALUE_SYMTAB>
30*76a1c1d0STeresa Johnson
31*76a1c1d0STeresa Johnson; ModuleID = 'thinlto-function-summary-callgraph.ll'
32*76a1c1d0STeresa Johnsontarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
33*76a1c1d0STeresa Johnsontarget triple = "x86_64-unknown-linux-gnu"
34*76a1c1d0STeresa Johnson
35*76a1c1d0STeresa Johnson; Function Attrs: nounwind uwtable
36*76a1c1d0STeresa Johnsondefine i32 @main() #0 {
37*76a1c1d0STeresa Johnsonentry:
38*76a1c1d0STeresa Johnson    call void (...) @func()
39*76a1c1d0STeresa Johnson    ret i32 0
40*76a1c1d0STeresa Johnson}
41*76a1c1d0STeresa Johnson
42*76a1c1d0STeresa Johnsondeclare void @func(...) #1
43