Revert r354244 "[DAGCombiner] Eliminate dead stores to stack."
[llvm-complete.git] / test / ThinLTO / X86 / dot-dumper.ll
blob571e968c2b1a0b00cbc9399ea0824fdb3e405d2f
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, \
7 ; RUN:  -r=%t1.bc,A, \
8 ; RUN:  -r=%t2.bc,foo,p \
9 ; RUN:  -r=%t2.bc,bar,p \
10 ; RUN:  -r=%t2.bc,A,p \
11 ; RUN:  -r=%t2.bc,B,p
13 ; Never assume specific order of clusters, nodes or edges
14 ; RUN: cat %t1.dot | FileCheck --check-prefix=STRUCTURE1 %s
15 ; RUN: cat %t1.dot | FileCheck --check-prefix=CLUSTER0 --check-prefix=PERMODULE0 %s
16 ; RUN: cat %t2.dot | FileCheck --check-prefix=STRUCTURE2 %s
17 ; RUN: cat %t2.dot | FileCheck --check-prefix=CLUSTER1 --check-prefix=PERMODULE1 %s
18 ; RUN: cat %t3.index.dot | FileCheck --check-prefix=STRUCTURE %s
19 ; RUN: cat %t3.index.dot | FileCheck --check-prefix=CLUSTER0 --check-prefix=COMBINED0 %s
20 ; RUN: cat %t3.index.dot | FileCheck --check-prefix=CLUSTER1 --check-prefix=COMBINED1 %s
22 ; %t1 index
23 ; STRUCTURE1:        digraph Summary {
24 ; STRUCTURE1:          subgraph cluster_0
25 ; STRUCTURE1:          // Cross-module edges:
26 ; STRUCTURE1:          0 [label="@0"]; // defined externally
27 ; STRUCTURE1:          M0_{{[0-9]+}} -> 0 [style=dotted]; // alias
28 ; STRUCTURE1-DAG:      [[A:[0-9]+]] [label="A"]; // defined externally
29 ; STRUCTURE1-DAG:      [[FOO:[0-9]+]] [label="foo"]; // defined externally
30 ; STRUCTURE1-DAG:      M0_{{[0-9]+}} -> [[FOO]] // call
31 ; STRUCTURE1-DAG:      M0_{{[0-9]+}} -> [[A]] [{{.*}}]; // const-ref
32 ; STRUCTURE1-NEXT:   }
34 ; %t2 index
35 ; STRUCTURE2:        digraph Summary {
36 ; STRUCTURE2:          subgraph cluster_0
37 ; STRUCTURE2:          // Cross-module edges:
38 ; STRUCTURE2-NEXT:   }
40 ; Combined index
41 ; STRUCTURE:        digraph Summary {
42 ; STRUCTURE-DAG:      subgraph cluster_0
43 ; STRUCTURE-DAG:      subgraph cluster_1
44 ; STRUCTURE:          // Cross-module edges:
45 ; STRUCTURE-DAG:      M0_{{[0-9]+}} -> M1_{{[0-9]+}} // call
46 ; STRUCTURE-DAG:      M0_{{[0-9]+}} -> M1_{{[0-9]+}} [{{.*}}]; // const-ref
47 ; STRUCTURE-NEXT:   }
49 ; PERMODULE0:       // Module:
50 ; COMBINED0:        // Module: {{.*}}1.bc
51 ; CLUSTER0-NEXT:    subgraph cluster_[[ID0:[0-1]]] {
52 ; CLUSTER0-DAG:       M[[ID0]]_[[MAIN_ALIAS:[0-9]+]] [{{.*}}main_alias{{.*}}]; // alias, dead
53 ; CLUSTER0-DAG:       M[[ID0]]_[[MAIN:[0-9]+]] [{{.*}}main|extern{{.*}}]; // function
54 ; CLUSTER0-NEXT:      // Edges:
55 ; COMBINED0-NEXT:     M[[ID0]]_[[MAIN_ALIAS]] -> M[[ID0]]_[[MAIN]] [{{.*}}]; // alias
56 ; CLUSTER0-NEXT:    }
58 ; PERMODULE1:       // Module:
59 ; COMBINED1:        // Module: {{.*}}2.bc
60 ; CLUSTER1-NEXT:    subgraph cluster_[[ID1:[0-1]]] {
61 ; CLUSTER1-DAG:       M[[ID1]]_[[A:[0-9]+]] [{{.*}}A|extern{{.*}}]; // variable
62 ; COMBINED1-SAME:       , immutable
63 ; CLUSTER1-DAG:       M[[ID1]]_[[FOO:[0-9]+]] [{{.*}}foo|extern{{.*}} ffl: 00001{{.*}}]; // function
64 ; CLUSTER1-DAG:       M[[ID1]]_[[B:[0-9]+]] [{{.*}}B|extern{{.*}}]; // variable
65 ; COMBINED1-SAME:       , immutable
66 ; CLUSTER1-DAG:       M[[ID1]]_[[BAR:[0-9]+]] [{{.*}}bar|extern{{.*}}]; // function, dead
67 ; CLUSTER1-NEXT:      // Edges:
68 ; CLUSTER1-DAG:       M[[ID1]]_[[FOO]] -> M[[ID1]]_[[B]] [{{.*}}]; // const-ref
69 ; CLUSTER1-DAG:       M[[ID1]]_[[FOO]] -> M[[ID1]]_[[A]] [{{.*}}]; // const-ref
70 ; CLUSTER1-DAG:     }
72 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
73 target triple = "x86_64-unknown-linux-gnu"
75 @A = external local_unnamed_addr global i32, align 4
77 ; Function Attrs: nounwind uwtable
78 define i32 @main() local_unnamed_addr {
79   %1 = tail call i32 (...) @foo()
80   %2 = load i32, i32* @A, align 4
81   %3 = add nsw i32 %2, %1
82   ret i32 %3
84 @main_alias = weak_odr alias i32 (), i32 ()* @main
85 declare i32 @foo(...) local_unnamed_addr