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