blob: 7c7a6f6c92468d25cf716cfdef537b30df12aad5 [file] [log] [blame]
Easwaran Raman259c18e2018-01-25 22:23:52 +00001; Test to check the callgraph in summary
2; RUN: opt -write-relbf-to-summary -module-summary %s -o %t.o
3; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
Teresa Johnsona9a21472018-05-26 02:34:13 +00004; RUN: llvm-dis -o - %t.o | FileCheck %s --check-prefix=DIS
Teresa Johnsonc6dda902018-06-26 13:56:49 +00005; Round trip it through llvm-as
6; RUN: llvm-dis -o - %t.o | llvm-as -write-relbf-to-summary -o - | llvm-dis -o - | FileCheck %s --check-prefix=DIS
Easwaran Raman259c18e2018-01-25 22:23:52 +00007
8; CHECK: <SOURCE_FILENAME
9; CHECK-NEXT: <GLOBALVAR
10; CHECK-NEXT: <FUNCTION
11; "func"
12; CHECK-NEXT: <FUNCTION op0=17 op1=4
13; CHECK: <GLOBALVAL_SUMMARY_BLOCK
14; CHECK-NEXT: <VERSION
Teresa Johnsone3937752019-01-11 18:31:57 +000015; CHECK-NEXT: <FLAGS
Easwaran Raman259c18e2018-01-25 22:23:52 +000016; See if the call to func is registered.
Eugene Levianta3f1de92018-11-16 07:08:00 +000017; CHECK-NEXT: <PERMODULE_RELBF {{.*}} op4=1 {{.*}} op8=256
Easwaran Raman259c18e2018-01-25 22:23:52 +000018; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
19; CHECK: <STRTAB_BLOCK
20; CHECK-NEXT: blob data = 'undefinedglobmainfunc{{.*}}'
21
22
23; ModuleID = 'thinlto-function-summary-callgraph.ll'
24target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
25target triple = "x86_64-unknown-linux-gnu"
26
27; Function Attrs: nounwind uwtable
28define i32 @main() #0 {
29entry:
30 call void (...) @func()
31 %u = load i32, i32* @undefinedglob
32 ret i32 %u
33}
34
35declare void @func(...) #1
36@undefinedglob = external global i32
37
38; OLD: Index {{.*}} contains 1 nodes (1 functions, 0 alias, 0 globals) and 1 edges (0 refs and 1 calls)
Teresa Johnsona9a21472018-05-26 02:34:13 +000039
Teresa Johnsonc6dda902018-06-26 13:56:49 +000040; DIS: ^0 = module: (path: "{{.*}}", hash: (0, 0, 0, 0, 0))
Teresa Johnsona9a21472018-05-26 02:34:13 +000041; DIS: ^1 = gv: (name: "func") ; guid = 7289175272376759421
Eugene Leviantae9f7732018-11-23 10:54:51 +000042; 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: (readonly ^3)))) ; guid = 15822663052811949562
Teresa Johnsona9a21472018-05-26 02:34:13 +000043; DIS: ^3 = gv: (name: "undefinedglob") ; guid = 18036901804029949403