16b7209b3SEaswaran Raman; Test to check the callgraph in summary
26b7209b3SEaswaran Raman; RUN: opt -write-relbf-to-summary -module-summary %s -o %t.o
36b7209b3SEaswaran Raman; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
408d5b4efSTeresa Johnson; RUN: llvm-dis -o - %t.o | FileCheck %s --check-prefix=DIS
5*63ee0e73STeresa Johnson; Round trip it through llvm-as
6*63ee0e73STeresa Johnson; RUN: llvm-dis -o - %t.o | llvm-as -write-relbf-to-summary -o - | llvm-dis -o - | FileCheck %s --check-prefix=DIS
76b7209b3SEaswaran Raman
86b7209b3SEaswaran Raman; CHECK: <SOURCE_FILENAME
96b7209b3SEaswaran Raman; CHECK-NEXT: <GLOBALVAR
106b7209b3SEaswaran Raman; CHECK-NEXT: <FUNCTION
116b7209b3SEaswaran Raman; "func"
126b7209b3SEaswaran Raman; CHECK-NEXT: <FUNCTION op0=17 op1=4
136b7209b3SEaswaran Raman; CHECK:       <GLOBALVAL_SUMMARY_BLOCK
146b7209b3SEaswaran Raman; CHECK-NEXT:    <VERSION
156b7209b3SEaswaran Raman; See if the call to func is registered.
16385d8ea8SEaswaran Raman; CHECK-NEXT:    <PERMODULE_RELBF {{.*}} op4=1 {{.*}} op7=256
176b7209b3SEaswaran Raman; CHECK-NEXT:  </GLOBALVAL_SUMMARY_BLOCK>
186b7209b3SEaswaran Raman; CHECK: <STRTAB_BLOCK
196b7209b3SEaswaran Raman; CHECK-NEXT: blob data = 'undefinedglobmainfunc{{.*}}'
206b7209b3SEaswaran Raman
216b7209b3SEaswaran Raman
226b7209b3SEaswaran Raman; ModuleID = 'thinlto-function-summary-callgraph.ll'
236b7209b3SEaswaran Ramantarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
246b7209b3SEaswaran Ramantarget triple = "x86_64-unknown-linux-gnu"
256b7209b3SEaswaran Raman
266b7209b3SEaswaran Raman; Function Attrs: nounwind uwtable
276b7209b3SEaswaran Ramandefine i32 @main() #0 {
286b7209b3SEaswaran Ramanentry:
296b7209b3SEaswaran Raman    call void (...) @func()
306b7209b3SEaswaran Raman    %u = load i32, i32* @undefinedglob
316b7209b3SEaswaran Raman    ret i32 %u
326b7209b3SEaswaran Raman}
336b7209b3SEaswaran Raman
346b7209b3SEaswaran Ramandeclare void @func(...) #1
356b7209b3SEaswaran Raman@undefinedglob = external global i32
366b7209b3SEaswaran Raman
376b7209b3SEaswaran Raman; OLD: Index {{.*}} contains 1 nodes (1 functions, 0 alias, 0 globals) and 1 edges (0 refs and 1 calls)
3808d5b4efSTeresa Johnson
39*63ee0e73STeresa Johnson; DIS: ^0 = module: (path: "{{.*}}", hash: (0, 0, 0, 0, 0))
4008d5b4efSTeresa Johnson; DIS: ^1 = gv: (name: "func") ; guid = 7289175272376759421
4108d5b4efSTeresa Johnson; DIS: ^2 = gv: (name: "main", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 3, calls: ((callee: ^1, relbf: 256)), refs: (^3)))) ; guid = 15822663052811949562
4208d5b4efSTeresa Johnson; DIS: ^3 = gv: (name: "undefinedglob") ; guid = 18036901804029949403
43