blob: f3896d2baba769c8d7df9e60246e091e0f6250f0 [file] [log] [blame]
Mehdi Aminieb79e6e2016-04-16 06:56:44 +00001; Test to check the callgraph in summary
2; RUN: opt -module-summary %s -o %t.o
3; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
4; RUN: opt -module-summary %p/Inputs/thinlto-alias.ll -o %t2.o
Teresa Johnsona9a21472018-05-26 02:34:13 +00005; RUN: llvm-dis -o - %t2.o | FileCheck %s --check-prefix=DIS
Teresa Johnsonc6dda902018-06-26 13:56:49 +00006; Round trip it through llvm-as
7; RUN: llvm-dis -o - %t2.o | llvm-as -o - | llvm-dis -o - | FileCheck %s --check-prefix=DIS
Mehdi Aminieb79e6e2016-04-16 06:56:44 +00008; RUN: llvm-lto -thinlto -o %t3 %t.o %t2.o
9; RUN: llvm-bcanalyzer -dump %t3.thinlto.bc | FileCheck %s --check-prefix=COMBINED
Teresa Johnsona9a21472018-05-26 02:34:13 +000010; RUN: llvm-dis -o - %t3.thinlto.bc | FileCheck %s --check-prefix=COMBINED-DIS
Teresa Johnsonc6dda902018-06-26 13:56:49 +000011; Round trip it through llvm-as
12; RUN: llvm-dis -o - %t3.thinlto.bc | llvm-as -o - | llvm-dis -o - | FileCheck %s --check-prefix=COMBINED-DIS
Mehdi Aminieb79e6e2016-04-16 06:56:44 +000013
Peter Collingbourne6163b4a2017-04-17 17:51:36 +000014; CHECK: <SOURCE_FILENAME
15; "main"
16; CHECK-NEXT: <FUNCTION op0=0 op1=4
17; "analias"
18; CHECK-NEXT: <FUNCTION op0=4 op1=7
Mehdi Aminieb79e6e2016-04-16 06:56:44 +000019; CHECK: <GLOBALVAL_SUMMARY_BLOCK
Mehdi Amini3f53abc2016-04-24 03:18:11 +000020; CHECK-NEXT: <VERSION
Teresa Johnsone3937752019-01-11 18:31:57 +000021; CHECK-NEXT: <FLAGS
Peter Collingbourne6163b4a2017-04-17 17:51:36 +000022; See if the call to func is registered.
23; The value id 1 matches the second FUNCTION record above.
Eugene Levianta3f1de92018-11-16 07:08:00 +000024; CHECK-NEXT: <PERMODULE {{.*}} op6=1/>
Mehdi Aminieb79e6e2016-04-16 06:56:44 +000025; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
Peter Collingbourne6163b4a2017-04-17 17:51:36 +000026
27; CHECK: <STRTAB_BLOCK
Peter Collingbournefdc12502017-06-27 23:50:11 +000028; CHECK-NEXT: blob data = 'mainanalias{{.*}}'
Mehdi Aminieb79e6e2016-04-16 06:56:44 +000029
30; COMBINED: <GLOBALVAL_SUMMARY_BLOCK
Mehdi Amini3f53abc2016-04-24 03:18:11 +000031; COMBINED-NEXT: <VERSION
Teresa Johnsond3f03a62018-02-07 04:05:59 +000032; COMBINED-NEXT: <FLAGS
Peter Collingbourne6163b4a2017-04-17 17:51:36 +000033; See if the call to analias is registered, using the expected value id.
34; COMBINED-NEXT: <VALUE_GUID op0=[[ALIASID:[0-9]+]] op1=-5751648690987223394/>
35; COMBINED-NEXT: <VALUE_GUID
36; COMBINED-NEXT: <VALUE_GUID op0=[[ALIASEEID:[0-9]+]] op1=-1039159065113703048/>
Easwaran Ramanf1f1adc2018-12-13 19:54:27 +000037; COMBINED-NEXT: <COMBINED {{.*}} op8=[[ALIASID]]/>
Mehdi Aminieb79e6e2016-04-16 06:56:44 +000038; COMBINED-NEXT: <COMBINED {{.*}}
Peter Collingbourne6163b4a2017-04-17 17:51:36 +000039; COMBINED-NEXT: <COMBINED_ALIAS {{.*}} op3=[[ALIASEEID]]
Mehdi Aminieb79e6e2016-04-16 06:56:44 +000040; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK
Mehdi Aminieb79e6e2016-04-16 06:56:44 +000041
42; ModuleID = 'thinlto-function-summary-callgraph.ll'
43target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
44target triple = "x86_64-unknown-linux-gnu"
45
46; Function Attrs: nounwind uwtable
47define i32 @main() {
48entry:
49 call void (...) @analias()
50 ret i32 0
51}
52
53declare void @analias(...)
Teresa Johnsona9a21472018-05-26 02:34:13 +000054
Teresa Johnsonc6dda902018-06-26 13:56:49 +000055; DIS: ^0 = module: (path: "{{.*}}", hash: (0, 0, 0, 0, 0))
Teresa Johnsona9a21472018-05-26 02:34:13 +000056; DIS: ^1 = gv: (name: "analias", summaries: (alias: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), aliasee: ^2))) ; guid = 12695095382722328222
57; DIS: ^2 = gv: (name: "aliasee", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1))) ; guid = 17407585008595848568
58
Teresa Johnson2a70cfb2018-05-26 03:50:29 +000059; COMBINED-DIS: ^0 = module: (path: "{{.*}}thinlto-alias.ll.tmp.o", hash: (0, 0, 0, 0, 0))
60; COMBINED-DIS: ^1 = module: (path: "{{.*}}thinlto-alias.ll.tmp2.o", hash: (0, 0, 0, 0, 0))
Teresa Johnsona9a21472018-05-26 02:34:13 +000061; COMBINED-DIS: ^2 = gv: (guid: 12695095382722328222, summaries: (alias: (module: ^1, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), aliasee: ^4)))
62; COMBINED-DIS: ^3 = gv: (guid: 15822663052811949562, summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 2, calls: ((callee: ^2)))))
63; COMBINED-DIS: ^4 = gv: (guid: 17407585008595848568, summaries: (function: (module: ^1, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1)))