1; Test writeOnly attribute
2; RUN: opt -module-summary %s -o %t1.bc
3; RUN: opt -module-summary %p/Inputs/dot-dumper2.ll -o %t2.bc
4; RUN: llvm-lto2 run -save-temps %t1.bc %t2.bc -o %t3 \
5; RUN:  -r=%t1.bc,main,px \
6; RUN:  -r=%t1.bc,A, \
7; RUN:  -r=%t2.bc,A,p
8
9; RUN: cat %t3.index.dot | FileCheck --check-prefix=COMBINED %s
10
11; COMBINED: digraph Summary {
12; COMBINED-NEXT:  // Module:
13; COMBINED-NEXT:  subgraph cluster_0 {
14; COMBINED-NEXT:    style = filled;
15; COMBINED-NEXT:    color = lightgrey;
16; COMBINED-NEXT:    label =
17; COMBINED-NEXT:    node [style=filled,fillcolor=lightblue];
18; COMBINED-NEXT:    M0_[[MAIN:[0-9]+]] [shape="record",label="main|extern (inst: 2, ffl: 000000)}"]; // function
19; COMBINED-NEXT:    // Edges:
20; COMBINED-NEXT:  }
21; COMBINED-NEXT:  // Module:
22; COMBINED-NEXT:  subgraph cluster_1 {
23; COMBINED-NEXT:    style = filled;
24; COMBINED-NEXT:    color = lightgrey;
25; COMBINED-NEXT:    label =
26; COMBINED-NEXT:    node [style=filled,fillcolor=lightblue];
27; COMBINED-NEXT:    M1_[[A:[0-9]+]] [shape="Mrecord",label="A|extern}"]; // variable, writeOnly
28; COMBINED-NEXT:    // Edges:
29; COMBINED-NEXT:  }
30; COMBINED-NEXT:  // Cross-module edges:
31; COMBINED-NEXT:  M0_[[MAIN]] -> M1_[[A]] [style=dashed,color=violetred]; // writeOnly-ref
32; COMBINED-NEXT: }
33
34target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
35target triple = "x86_64-unknown-linux-gnu"
36
37@A = external local_unnamed_addr global i32, align 4
38
39; Function Attrs: nounwind uwtable
40define i32 @main() local_unnamed_addr {
41  store i32 42, i32* @A, align 4
42  ret i32 0
43}
44