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
563ee0e73STeresa Johnson; Round trip it through llvm-as
663ee0e73STeresa 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
15290a8398STeresa Johnson; CHECK-NEXT:    <FLAGS
166b7209b3SEaswaran Raman; See if the call to func is registered.
173aef3528SEugene Leviant; CHECK-NEXT:    <PERMODULE_RELBF {{.*}} op4=1 {{.*}} op9=256
18a7fa35a6SHiroshi Yamauchi; CHECK-NEXT:    <BLOCK_COUNT op0=1/>
196b7209b3SEaswaran Raman; CHECK-NEXT:  </GLOBALVAL_SUMMARY_BLOCK>
206b7209b3SEaswaran Raman; CHECK: <STRTAB_BLOCK
216b7209b3SEaswaran Raman; CHECK-NEXT: blob data = 'undefinedglobmainfunc{{.*}}'
226b7209b3SEaswaran Raman
236b7209b3SEaswaran Raman
246b7209b3SEaswaran Raman; ModuleID = 'thinlto-function-summary-callgraph.ll'
256b7209b3SEaswaran Ramantarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
266b7209b3SEaswaran Ramantarget triple = "x86_64-unknown-linux-gnu"
276b7209b3SEaswaran Raman
286b7209b3SEaswaran Raman; Function Attrs: nounwind uwtable
296b7209b3SEaswaran Ramandefine i32 @main() #0 {
306b7209b3SEaswaran Ramanentry:
316b7209b3SEaswaran Raman    call void (...) @func()
326b7209b3SEaswaran Raman    %u = load i32, i32* @undefinedglob
336b7209b3SEaswaran Raman    ret i32 %u
346b7209b3SEaswaran Raman}
356b7209b3SEaswaran Raman
366b7209b3SEaswaran Ramandeclare void @func(...) #1
376b7209b3SEaswaran Raman@undefinedglob = external global i32
386b7209b3SEaswaran Raman
396b7209b3SEaswaran Raman; OLD: Index {{.*}} contains 1 nodes (1 functions, 0 alias, 0 globals) and 1 edges (0 refs and 1 calls)
4008d5b4efSTeresa Johnson
4163ee0e73STeresa Johnson; DIS: ^0 = module: (path: "{{.*}}", hash: (0, 0, 0, 0, 0))
4208d5b4efSTeresa Johnson; DIS: ^1 = gv: (name: "func") ; guid = 7289175272376759421
43*54fb3ca9SFangrui Song; DIS: ^2 = gv: (name: "main", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 3, calls: ((callee: ^1, relbf: 256)), refs: (readonly ^3)))) ; guid = 15822663052811949562
4408d5b4efSTeresa Johnson; DIS: ^3 = gv: (name: "undefinedglob") ; guid = 18036901804029949403
45