blob: 1389710e18d0a4c6797f3cf1536bdb5817c22131 [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 Johnsona6a3fb52017-05-31 18:58:11 +000029; Only 2 VALUE_GUID since reference to undefinedglob should not be included in
30; combined index.
Peter Collingbournea0f371a2017-04-17 17:51:36 +000031; COMBINED-NEXT: <VALUE_GUID op0=[[FUNCID:[0-9]+]] op1=7289175272376759421/>
32; COMBINED-NEXT: <VALUE_GUID
Teresa Johnson76a1c1d2016-03-11 18:52:24 +000033; COMBINED-NEXT: <COMBINED
Peter Collingbournea0f371a2017-04-17 17:51:36 +000034; See if the call to func is registered.
Charles Saternos75da10d2017-08-04 16:00:58 +000035; COMBINED-NEXT: <COMBINED {{.*}} op6=[[FUNCID]]/>
Teresa Johnson76a1c1d2016-03-11 18:52:24 +000036; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
Teresa Johnson76a1c1d2016-03-11 18:52:24 +000037
38; ModuleID = 'thinlto-function-summary-callgraph.ll'
39target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
40target triple = "x86_64-unknown-linux-gnu"
41
42; Function Attrs: nounwind uwtable
43define i32 @main() #0 {
44entry:
45 call void (...) @func()
Teresa Johnsona6a3fb52017-05-31 18:58:11 +000046 %u = load i32, i32* @undefinedglob
47 ret i32 %u
Teresa Johnson76a1c1d2016-03-11 18:52:24 +000048}
49
50declare void @func(...) #1
Teresa Johnsona6a3fb52017-05-31 18:58:11 +000051@undefinedglob = external global i32
Piotr Padlewskid9830eb2016-09-26 20:37:32 +000052
53; 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 +000054; OLD-COMBINED: Index {{.*}} contains 2 nodes (2 functions, 0 alias, 0 globals) and 1 edges (0 refs and 1 calls)