blob: 8025eee5929ba9a6770c3aaf41ece19d584c21ae [file] [log] [blame]
Teresa Johnson76a1c1d2016-03-11 18:52:24 +00001; Test to check the callgraph in summary
Mehdi Amini68da4262016-04-12 21:35:18 +00002; RUN: opt -module-summary %s -o %t.o
Teresa Johnson76a1c1d2016-03-11 18:52:24 +00003; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
Piotr Padlewskid9830eb2016-09-26 20:37:32 +00004
Mehdi Amini68da4262016-04-12 21:35:18 +00005; RUN: opt -module-summary %p/Inputs/thinlto-function-summary-callgraph.ll -o %t2.o
Teresa Johnson76a1c1d2016-03-11 18:52:24 +00006; RUN: llvm-lto -thinlto -o %t3 %t.o %t2.o
7; RUN: llvm-bcanalyzer -dump %t3.thinlto.bc | FileCheck %s --check-prefix=COMBINED
8
Piotr Padlewskid9830eb2016-09-26 20:37:32 +00009; Check parsing for old summary versions generated from this file.
10; RUN: llvm-lto -thinlto-index-stats %p/Inputs/thinlto-function-summary-callgraph.1.bc | FileCheck %s --check-prefix=OLD
11; RUN: llvm-lto -thinlto-index-stats %p/Inputs/thinlto-function-summary-callgraph-combined.1.bc | FileCheck %s --check-prefix=OLD-COMBINED
12
Peter Collingbournea0f371a2017-04-17 17:51:36 +000013; CHECK: <SOURCE_FILENAME
Teresa Johnsona6a3fb52017-05-31 18:58:11 +000014; CHECK-NEXT: <GLOBALVAR
Peter Collingbournea0f371a2017-04-17 17:51:36 +000015; CHECK-NEXT: <FUNCTION
16; "func"
Teresa Johnsona6a3fb52017-05-31 18:58:11 +000017; CHECK-NEXT: <FUNCTION op0=17 op1=4
Teresa Johnson76a1c1d2016-03-11 18:52:24 +000018; CHECK: <GLOBALVAL_SUMMARY_BLOCK
Mehdi Amini8fe69362016-04-24 03:18:11 +000019; CHECK-NEXT: <VERSION
Peter Collingbournea0f371a2017-04-17 17:51:36 +000020; See if the call to func is registered.
Charles Saternos75da10d2017-08-04 16:00:58 +000021; CHECK-NEXT: <PERMODULE {{.*}} op4=1
Teresa Johnson76a1c1d2016-03-11 18:52:24 +000022; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
Peter Collingbournea0f371a2017-04-17 17:51:36 +000023; CHECK: <STRTAB_BLOCK
Peter Collingbourne92648c22017-06-27 23:50:11 +000024; CHECK-NEXT: blob data = 'undefinedglobmainfunc{{.*}}'
Peter Collingbournea0f371a2017-04-17 17:51:36 +000025
Teresa Johnson76a1c1d2016-03-11 18:52:24 +000026
27; COMBINED: <GLOBALVAL_SUMMARY_BLOCK
Mehdi Amini8fe69362016-04-24 03:18:11 +000028; COMBINED-NEXT: <VERSION
Teresa Johnsonf3681012018-02-07 04:05:59 +000029; COMBINED-NEXT: <FLAGS
Teresa Johnsona6a3fb52017-05-31 18:58:11 +000030; Only 2 VALUE_GUID since reference to undefinedglob should not be included in
31; combined index.
Peter Collingbournea0f371a2017-04-17 17:51:36 +000032; COMBINED-NEXT: <VALUE_GUID op0=[[FUNCID:[0-9]+]] op1=7289175272376759421/>
33; COMBINED-NEXT: <VALUE_GUID
Teresa Johnson76a1c1d2016-03-11 18:52:24 +000034; COMBINED-NEXT: <COMBINED
Peter Collingbournea0f371a2017-04-17 17:51:36 +000035; See if the call to func is registered.
Charles Saternos75da10d2017-08-04 16:00:58 +000036; COMBINED-NEXT: <COMBINED {{.*}} op6=[[FUNCID]]/>
Teresa Johnson76a1c1d2016-03-11 18:52:24 +000037; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
Teresa Johnson76a1c1d2016-03-11 18:52:24 +000038
39; ModuleID = 'thinlto-function-summary-callgraph.ll'
40target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
41target triple = "x86_64-unknown-linux-gnu"
42
43; Function Attrs: nounwind uwtable
44define i32 @main() #0 {
45entry:
46 call void (...) @func()
Teresa Johnsona6a3fb52017-05-31 18:58:11 +000047 %u = load i32, i32* @undefinedglob
48 ret i32 %u
Teresa Johnson76a1c1d2016-03-11 18:52:24 +000049}
50
51declare void @func(...) #1
Teresa Johnsona6a3fb52017-05-31 18:58:11 +000052@undefinedglob = external global i32
Piotr Padlewskid9830eb2016-09-26 20:37:32 +000053
54; OLD: Index {{.*}} contains 1 nodes (1 functions, 0 alias, 0 globals) and 1 edges (0 refs and 1 calls)
Peter Collingbournea0f371a2017-04-17 17:51:36 +000055; OLD-COMBINED: Index {{.*}} contains 2 nodes (2 functions, 0 alias, 0 globals) and 1 edges (0 refs and 1 calls)