1 ; RUN: opt -module-summary %s -o %t1.bc -module-summary-dot-file=%t1.dot
2 ; RUN: opt -module-summary %p/Inputs/dot-dumper.ll -o %t2.bc -module-summary-dot-file=%t2.dot
3 ; RUN: llvm-lto2 run -save-temps %t1.bc %t2.bc -o %t3 \
4 ; RUN: -r=%t1.bc,main,px \
5 ; RUN: -r=%t1.bc,main_alias,p \
6 ; RUN: -r=%t1.bc,foo, \
8 ; RUN: -r=%t2.bc,foo,p \
9 ; RUN: -r=%t2.bc,bar,p \
10 ; RUN: -r=%t2.bc,A,p \
13 ; RUN: cat %t1.dot | FileCheck --check-prefix=PERMODULE %s
14 ; RUN: cat %t3.index.dot | FileCheck --check-prefix=COMBINED %s
16 ; PERMODULE: digraph Summary {
17 ; PERMODULE-NEXT: // Module:
18 ; PERMODULE-NEXT: subgraph cluster_0 {
19 ; PERMODULE-NEXT: style = filled;
20 ; PERMODULE-NEXT: color = lightgrey;
21 ; PERMODULE-NEXT: label = "";
22 ; PERMODULE-NEXT: node [style=filled,fillcolor=lightblue];
23 ; PERMODULE-NEXT: M0_[[MAIN_ALIAS:[0-9]+]] [style="dotted,filled",shape="box",label="main_alias",fillcolor="red"]; // alias, definition, dead
24 ; PERMODULE-NEXT: M0_[[MAIN:[0-9]+]] [shape="record",label="main|extern (inst: 4, ffl: 0000000000)}",fillcolor="red"]; // function, definition, dead
25 ; PERMODULE-NEXT: // Edges:
26 ; PERMODULE-NEXT: M0_[[MAIN_ALIAS]] -> M0_[[MAIN]] [style=dotted]; // alias
28 ; PERMODULE-NEXT: // Cross-module edges:
29 ; PERMODULE-NEXT: [[A:[0-9]+]] [label="A"]; // defined externally
30 ; PERMODULE-NEXT: M0_[[MAIN]] -> [[A]] [style=dashed,color=forestgreen]; // const-ref
31 ; PERMODULE-NEXT: [[FOO:[0-9]+]] [label="foo"]; // defined externally
32 ; PERMODULE-NEXT: M0_[[MAIN]] -> [[FOO]] // call (hotness : Unknown)
35 ; COMBINED: digraph Summary {
36 ; COMBINED-NEXT: // Module: {{.*}}dot-dumper{{.*}}1.bc
37 ; COMBINED-NEXT: subgraph cluster_0 {
38 ; COMBINED-NEXT: style = filled;
39 ; COMBINED-NEXT: color = lightgrey;
40 ; COMBINED-NEXT: label = "dot-dumper{{.*}}1.bc";
41 ; COMBINED-NEXT: node [style=filled,fillcolor=lightblue];
42 ; COMBINED-NEXT: M0_[[MAIN_ALIAS:[0-9]+]] [style="dotted,filled",shape="box",label="main_alias",fillcolor="red"]; // alias, definition, dead
43 ; COMBINED-NEXT: M0_[[MAIN:[0-9]+]] [shape="record",label="main|extern (inst: 4, ffl: 0000000000)}"]; // function, definition, preserved
44 ; COMBINED-NEXT: // Edges:
45 ; COMBINED-NEXT: M0_[[MAIN_ALIAS]] -> M0_[[MAIN]] [style=dotted]; // alias
47 ; COMBINED-NEXT: // Module: {{.*}}dot-dumper{{.*}}2.bc
48 ; COMBINED-NEXT: subgraph cluster_1 {
49 ; COMBINED-NEXT: style = filled;
50 ; COMBINED-NEXT: color = lightgrey;
51 ; COMBINED-NEXT: label = "dot-dumper{{.*}}2.bc";
52 ; COMBINED-NEXT: node [style=filled,fillcolor=lightblue];
53 ; COMBINED-NEXT: M1_[[FOO:[0-9]+]] [shape="record",label="foo|extern (inst: 4, ffl: 0000100000)}"]; // function, definition
54 ; COMBINED-NEXT: M1_[[A:[0-9]+]] [shape="Mrecord",label="A|extern}"]; // variable, immutable
55 ; COMBINED-NEXT: M1_[[B:[0-9]+]] [shape="Mrecord",label="B|extern}"]; // variable, immutable, constant
56 ; COMBINED-NEXT: M1_{{[0-9]+}} [shape="record",label="bar|extern (inst: 1, ffl: 0000000000)}",fillcolor="red"]; // function, definition, dead
57 ; COMBINED-NEXT: // Edges:
58 ; COMBINED-NEXT: M1_[[FOO]] -> M1_[[B]] [style=dashed,color=forestgreen]; // const-ref
59 ; COMBINED-NEXT: M1_[[FOO]] -> M1_[[A]] [style=dashed,color=forestgreen]; // const-ref
61 ; COMBINED-NEXT: // Cross-module edges:
62 ; COMBINED-NEXT: M0_[[MAIN]] -> M1_[[A]] [style=dashed,color=forestgreen]; // const-ref
63 ; COMBINED-NEXT: M0_[[MAIN]] -> M1_[[FOO]] // call (hotness : Unknown)
66 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
67 target triple = "x86_64-unknown-linux-gnu"
69 @A = external local_unnamed_addr global i32, align 4
71 ; Function Attrs: nounwind uwtable
72 define i32 @main() local_unnamed_addr {
73 %1 = tail call i32 (...) @foo()
74 %2 = load i32, ptr @A, align 4
75 %3 = add nsw i32 %2, %1
78 @main_alias = weak_odr alias i32 (), ptr @main
79 declare i32 @foo(...) local_unnamed_addr