1; Test to check the callgraph in summary
2; RUN: opt -module-summary %s -o %t.o
3; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
4; RUN: opt -module-summary %p/Inputs/thinlto-alias.ll -o %t2.o
5; RUN: llvm-dis -o - %t2.o | FileCheck %s --check-prefix=DIS
6; RUN: llvm-lto -thinlto -o %t3 %t.o %t2.o
7; RUN: llvm-bcanalyzer -dump %t3.thinlto.bc | FileCheck %s --check-prefix=COMBINED
8; RUN: llvm-dis -o - %t3.thinlto.bc | FileCheck %s --check-prefix=COMBINED-DIS
9
10; CHECK: <SOURCE_FILENAME
11; "main"
12; CHECK-NEXT: <FUNCTION op0=0 op1=4
13; "analias"
14; CHECK-NEXT: <FUNCTION op0=4 op1=7
15; CHECK:       <GLOBALVAL_SUMMARY_BLOCK
16; CHECK-NEXT:    <VERSION
17; See if the call to func is registered.
18; The value id 1 matches the second FUNCTION record above.
19; CHECK-NEXT:    <PERMODULE {{.*}} op5=1/>
20; CHECK-NEXT:  </GLOBALVAL_SUMMARY_BLOCK>
21
22; CHECK: <STRTAB_BLOCK
23; CHECK-NEXT: blob data = 'mainanalias{{.*}}'
24
25; COMBINED:       <GLOBALVAL_SUMMARY_BLOCK
26; COMBINED-NEXT:    <VERSION
27; COMBINED-NEXT:    <FLAGS
28; See if the call to analias is registered, using the expected value id.
29; COMBINED-NEXT:    <VALUE_GUID op0=[[ALIASID:[0-9]+]] op1=-5751648690987223394/>
30; COMBINED-NEXT:    <VALUE_GUID
31; COMBINED-NEXT:    <VALUE_GUID op0=[[ALIASEEID:[0-9]+]] op1=-1039159065113703048/>
32; COMBINED-NEXT:    <COMBINED {{.*}} op6=[[ALIASID]]/>
33; COMBINED-NEXT:    <COMBINED {{.*}}
34; COMBINED-NEXT:    <COMBINED_ALIAS  {{.*}} op3=[[ALIASEEID]]
35; COMBINED-NEXT:  </GLOBALVAL_SUMMARY_BLOCK
36
37; ModuleID = 'thinlto-function-summary-callgraph.ll'
38target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
39target triple = "x86_64-unknown-linux-gnu"
40
41; Function Attrs: nounwind uwtable
42define i32 @main() {
43entry:
44    call void (...) @analias()
45    ret i32 0
46}
47
48declare void @analias(...)
49
50; DIS: ^0 = module: (path: "{{.*}}/test/Bitcode/Output/thinlto-alias.ll.tmp2.o", hash: (0, 0, 0, 0, 0))
51; DIS: ^1 = gv: (name: "analias", summaries: (alias: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), aliasee: ^2))) ; guid = 12695095382722328222
52; DIS: ^2 = gv: (name: "aliasee", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1))) ; guid = 17407585008595848568
53
54; COMBINED-DIS: ^0 = module: (path: "{{.*}}/test/Bitcode/Output/thinlto-alias.ll.tmp.o", hash: (0, 0, 0, 0, 0))
55; COMBINED-DIS: ^1 = module: (path: "/usr/local/google/home/tejohnson/llvm/llvm_8_build/test/Bitcode/Output/thinlto-alias.ll.tmp2.o", hash: (0, 0, 0, 0, 0))
56; COMBINED-DIS: ^2 = gv: (guid: 12695095382722328222, summaries: (alias: (module: ^1, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), aliasee: ^4)))
57; COMBINED-DIS: ^3 = gv: (guid: 15822663052811949562, summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 2, calls: ((callee: ^2)))))
58; COMBINED-DIS: ^4 = gv: (guid: 17407585008595848568, summaries: (function: (module: ^1, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1)))
59