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-lto -thinlto -o %t3 %t.o %t2.o
6; RUN: llvm-bcanalyzer -dump %t3.thinlto.bc | FileCheck %s --check-prefix=COMBINED
7
8; CHECK:       <GLOBALVAL_SUMMARY_BLOCK
9; See if the call to func is registered, using the expected callsite count
10; and value id matching the subsequent value symbol table.
11; CHECK-NEXT:    <PERMODULE {{.*}} op4=[[FUNCID:[0-9]+]] op5=1/>
12; CHECK-NEXT:  </GLOBALVAL_SUMMARY_BLOCK>
13; CHECK-NEXT:  <VALUE_SYMTAB
14; CHECK-NEXT:    <FNENTRY {{.*}} record string = 'main'
15; External function analias should have entry with value id FUNCID
16; CHECK-NEXT:    <ENTRY {{.*}} op0=[[FUNCID]] {{.*}} record string = 'analias'
17; CHECK-NEXT:  </VALUE_SYMTAB>
18
19; COMBINED:       <GLOBALVAL_SUMMARY_BLOCK
20; See if the call to analias is registered, using the expected callsite count
21; and value id matching the subsequent value symbol table.
22; COMBINED-NEXT:    <COMBINED {{.*}} op4=[[ALIASID:[0-9]+]] op5=1/>
23; Followed by the alias and aliasee
24; COMBINED-NEXT:    <COMBINED {{.*}}
25; COMBINED-NEXT:    <COMBINED_ALIAS  {{.*}} op2=[[ALIASEEOFFSET:[0-9]+]]
26; COMBINED-NEXT:  </GLOBALVAL_SUMMARY_BLOCK
27; COMBINED-NEXT:  <VALUE_SYMTAB
28; Entry for function func should have entry with value id ALIASID
29; COMBINED-NEXT:    <COMBINED_GVDEFENTRY {{.*}} op0=[[ALIASID]] {{.*}} op2=-5751648690987223394/>
30; COMBINED-NEXT:    <COMBINED_GVDEFENTRY
31; COMBINED-NEXT:    <COMBINED_GVDEFENTRY  {{.*}} op1=[[ALIASEEOFFSET]] op2=-1039159065113703048/>
32; COMBINED-NEXT:  </VALUE_SYMTAB>
33
34; ModuleID = 'thinlto-function-summary-callgraph.ll'
35target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
36target triple = "x86_64-unknown-linux-gnu"
37
38; Function Attrs: nounwind uwtable
39define i32 @main() {
40entry:
41    call void (...) @analias()
42    ret i32 0
43}
44
45declare void @analias(...)
46