blob: 0969b849bc01218cb9f903d03d4a247994ace760 [file] [log] [blame]
Teresa Johnsondc6615a2016-03-11 18:52:24 +00001; Test to check the callgraph in summary
Mehdi Aminie58bfc92016-04-12 21:35:18 +00002; RUN: opt -module-summary %s -o %t.o
Teresa Johnsondc6615a2016-03-11 18:52:24 +00003; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
Piotr Padlewskifdf73542016-09-26 20:37:32 +00004
Mehdi Aminie58bfc92016-04-12 21:35:18 +00005; RUN: opt -module-summary %p/Inputs/thinlto-function-summary-callgraph.ll -o %t2.o
Teresa Johnsondc6615a2016-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 Padlewskifdf73542016-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 Collingbourne6163b4a2017-04-17 17:51:36 +000013; CHECK: <SOURCE_FILENAME
Teresa Johnsona01adef2017-05-31 18:58:11 +000014; CHECK-NEXT: <GLOBALVAR
Peter Collingbourne6163b4a2017-04-17 17:51:36 +000015; CHECK-NEXT: <FUNCTION
16; "func"
Teresa Johnsona01adef2017-05-31 18:58:11 +000017; CHECK-NEXT: <FUNCTION op0=17 op1=4
Teresa Johnsondc6615a2016-03-11 18:52:24 +000018; CHECK: <GLOBALVAL_SUMMARY_BLOCK
Mehdi Amini3f53abc2016-04-24 03:18:11 +000019; CHECK-NEXT: <VERSION
Teresa Johnsone3937752019-01-11 18:31:57 +000020; CHECK-NEXT: <FLAGS
Eugene Levianta3f1de92018-11-16 07:08:00 +000021; See if the call to func is registered
Charles Saternos4c314d62017-08-04 16:00:58 +000022; CHECK-NEXT: <PERMODULE {{.*}} op4=1
Teresa Johnsondc6615a2016-03-11 18:52:24 +000023; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
Peter Collingbourne6163b4a2017-04-17 17:51:36 +000024; CHECK: <STRTAB_BLOCK
Peter Collingbournefdc12502017-06-27 23:50:11 +000025; CHECK-NEXT: blob data = 'undefinedglobmainfunc{{.*}}'
Peter Collingbourne6163b4a2017-04-17 17:51:36 +000026
Teresa Johnsondc6615a2016-03-11 18:52:24 +000027
28; COMBINED: <GLOBALVAL_SUMMARY_BLOCK
Mehdi Amini3f53abc2016-04-24 03:18:11 +000029; COMBINED-NEXT: <VERSION
Teresa Johnsond3f03a62018-02-07 04:05:59 +000030; COMBINED-NEXT: <FLAGS
Teresa Johnsona01adef2017-05-31 18:58:11 +000031; Only 2 VALUE_GUID since reference to undefinedglob should not be included in
32; combined index.
Peter Collingbourne6163b4a2017-04-17 17:51:36 +000033; COMBINED-NEXT: <VALUE_GUID op0=[[FUNCID:[0-9]+]] op1=7289175272376759421/>
34; COMBINED-NEXT: <VALUE_GUID
Teresa Johnsondc6615a2016-03-11 18:52:24 +000035; COMBINED-NEXT: <COMBINED
Peter Collingbourne6163b4a2017-04-17 17:51:36 +000036; See if the call to func is registered.
Easwaran Ramanf1f1adc2018-12-13 19:54:27 +000037; COMBINED-NEXT: <COMBINED {{.*}} op8=[[FUNCID]]/>
Teresa Johnsondc6615a2016-03-11 18:52:24 +000038; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
Teresa Johnsondc6615a2016-03-11 18:52:24 +000039
40; ModuleID = 'thinlto-function-summary-callgraph.ll'
41target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
42target triple = "x86_64-unknown-linux-gnu"
43
44; Function Attrs: nounwind uwtable
45define i32 @main() #0 {
46entry:
47 call void (...) @func()
Teresa Johnsona01adef2017-05-31 18:58:11 +000048 %u = load i32, i32* @undefinedglob
49 ret i32 %u
Teresa Johnsondc6615a2016-03-11 18:52:24 +000050}
51
52declare void @func(...) #1
Teresa Johnsona01adef2017-05-31 18:58:11 +000053@undefinedglob = external global i32
Piotr Padlewskifdf73542016-09-26 20:37:32 +000054
55; OLD: Index {{.*}} contains 1 nodes (1 functions, 0 alias, 0 globals) and 1 edges (0 refs and 1 calls)
Peter Collingbourne6163b4a2017-04-17 17:51:36 +000056; OLD-COMBINED: Index {{.*}} contains 2 nodes (2 functions, 0 alias, 0 globals) and 1 edges (0 refs and 1 calls)