1 ; RUN: opt -module-summary %s -o %t1.bc
2 ; RUN: opt -module-summary %p/Inputs/index-const-prop-gvref.ll -o %t2.bc
3 ; RUN: llvm-lto2 run -relocation-model=static -save-temps %t2.bc -r=%t2.bc,b,pl -r=%t2.bc,a,pl \
4 ; RUN: %t1.bc -r=%t1.bc,main,plx -r=%t1.bc,a, -r=%t1.bc,b, -o %t3
5 ; RUN: llvm-dis %t3.1.3.import.bc -o - | FileCheck %s --check-prefix=SRC
6 ; RUN: llvm-dis %t3.2.3.import.bc -o - | FileCheck %s --check-prefix=DEST
8 ;; When producing an ELF DSO, clear dso_local for declarations to avoid direct access.
9 ; RUN: llvm-lto2 run -relocation-model=pic -save-temps %t2.bc -r=%t2.bc,b,pl -r=%t2.bc,a,pl \
10 ; RUN: %t1.bc -r=%t1.bc,main,plx -r=%t1.bc,a, -r=%t1.bc,b, -o %t4
11 ; RUN: llvm-dis %t4.1.3.import.bc -o - | FileCheck %s --check-prefix=SRC
12 ; RUN: llvm-dis %t4.2.3.import.bc -o - | FileCheck %s --check-prefix=DEST_DSO
14 ; No variable in the source module should have been internalized
15 ; SRC: @b = dso_local global ptr @a
16 ; SRC-NEXT: @a = dso_local global i32 42
18 ; We can't internalize globals referenced by other live globals
19 ; DEST: @b = external dso_local global ptr
20 ; DEST-NEXT: @a = available_externally dso_local global i32 42, align 4
21 ; DEST_DSO: @b = external global ptr
22 ; DEST_DSO-NEXT: @a = available_externally global i32 42, align 4
25 ;; When producing an ELF DSO, clear dso_local for declarations to avoid direct access.
26 ; RUN: llvm-lto -thinlto-action=run %t2.bc %t1.bc -relocation-model=static -thinlto-save-temps=%t5.
27 ; RUN: llvm-dis < %t5.0.3.imported.bc | FileCheck %s --check-prefix=OLDAPI_SRC
28 ; RUN: llvm-dis < %t5.1.3.imported.bc | FileCheck %s --check-prefix=OLDAPI_DST
29 ; RUN: llvm-lto -thinlto-action=run %t2.bc %t1.bc -relocation-model=pic -thinlto-save-temps=%t6.
30 ; RUN: llvm-dis < %t6.0.3.imported.bc | FileCheck %s --check-prefix=OLDAPI_SRC
31 ; RUN: llvm-dis < %t6.1.3.imported.bc | FileCheck %s --check-prefix=OLDAPI_DST_DSO
33 ; OLDAPI_SRC: @b = internal global ptr @a, align 8
34 ; OLDAPI_SRC-NEXT: @a = dso_local global i32 42, align 4
35 ; OLDAPI_DST: @b = external dso_local global ptr
36 ; OLDAPI_DST-NEXT: @a = available_externally dso_local global i32 42, align 4
37 ; OLDAPI_DST_DSO: @b = external global ptr
38 ; OLDAPI_DST_DSO-NEXT: @a = available_externally global i32 42, align 4
40 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
41 target triple = "x86_64-unknown-linux-gnu"
43 @a = external global i32
44 @b = external global ptr
47 %p = load ptr, ptr @b, align 8
48 store i32 33, ptr %p, align 4
49 %v = load i32, ptr @a, align 4