blob: c00907b7fb291169a60974f301d1f0b0005abe9b [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
Teresa Johnson76a1c1d2016-03-11 18:52:24 +000013; CHECK: <GLOBALVAL_SUMMARY_BLOCK
Mehdi Amini8fe69362016-04-24 03:18:11 +000014; CHECK-NEXT: <VERSION
Teresa Johnson76a1c1d2016-03-11 18:52:24 +000015; See if the call to func is registered, using the expected callsite count
16; and value id matching the subsequent value symbol table.
Piotr Padlewskid9830eb2016-09-26 20:37:32 +000017; CHECK-NEXT: <PERMODULE {{.*}} op4=[[FUNCID:[0-9]+]]/>
Teresa Johnson76a1c1d2016-03-11 18:52:24 +000018; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
19; CHECK-NEXT: <VALUE_SYMTAB
20; CHECK-NEXT: <FNENTRY {{.*}} record string = 'main'
21; External function func should have entry with value id FUNCID
22; CHECK-NEXT: <ENTRY {{.*}} op0=[[FUNCID]] {{.*}} record string = 'func'
23; CHECK-NEXT: </VALUE_SYMTAB>
24
25; COMBINED: <GLOBALVAL_SUMMARY_BLOCK
Mehdi Amini8fe69362016-04-24 03:18:11 +000026; COMBINED-NEXT: <VERSION
Teresa Johnson76a1c1d2016-03-11 18:52:24 +000027; COMBINED-NEXT: <COMBINED
28; See if the call to func is registered, using the expected callsite count
29; and value id matching the subsequent value symbol table.
Piotr Padlewskid9830eb2016-09-26 20:37:32 +000030; COMBINED-NEXT: <COMBINED {{.*}} op5=[[FUNCID:[0-9]+]]/>
Teresa Johnson76a1c1d2016-03-11 18:52:24 +000031; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
32; COMBINED-NEXT: <VALUE_SYMTAB
33; Entry for function func should have entry with value id FUNCID
Teresa Johnson02e98332016-04-27 13:28:35 +000034; COMBINED-NEXT: <COMBINED_ENTRY {{.*}} op0=[[FUNCID]] op1=7289175272376759421/>
35; COMBINED-NEXT: <COMBINED
Teresa Johnson76a1c1d2016-03-11 18:52:24 +000036; COMBINED-NEXT: </VALUE_SYMTAB>
37
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()
46 ret i32 0
47}
48
49declare void @func(...) #1
Piotr Padlewskid9830eb2016-09-26 20:37:32 +000050
51; OLD: Index {{.*}} contains 1 nodes (1 functions, 0 alias, 0 globals) and 1 edges (0 refs and 1 calls)
52; OLD-COMBINED: Index {{.*}} contains 2 nodes (2 functions, 0 alias, 0 globals) and 1 edges (0 refs and 1 calls)