52 lines · plain
1; RUN: opt -module-summary %s -o %t1.bc2; RUN: opt -module-summary %p/Inputs/index-const-prop-gvref.ll -o %t2.bc3; 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 %t35; RUN: llvm-dis %t3.1.3.import.bc -o - | FileCheck %s --check-prefix=SRC6; RUN: llvm-dis %t3.2.3.import.bc -o - | FileCheck %s --check-prefix=DEST7 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 %t411; RUN: llvm-dis %t4.1.3.import.bc -o - | FileCheck %s --check-prefix=SRC12; RUN: llvm-dis %t4.2.3.import.bc -o - | FileCheck %s --check-prefix=DEST_DSO13 14; No variable in the source module should have been internalized15; SRC: @b = dso_local global ptr @a16; SRC-NEXT: @a = dso_local global i32 4217 18; We can't internalize globals referenced by other live globals19; DEST: @b = external dso_local global ptr20; DEST-NEXT: @a = available_externally dso_local global i32 42, align 421; DEST_DSO: @b = external global ptr22; DEST_DSO-NEXT: @a = available_externally global i32 42, align 423 24;; Test old API.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_SRC28; RUN: llvm-dis < %t5.1.3.imported.bc | FileCheck %s --check-prefix=OLDAPI_DST29; 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_SRC31; RUN: llvm-dis < %t6.1.3.imported.bc | FileCheck %s --check-prefix=OLDAPI_DST_DSO32 33; OLDAPI_SRC: @b = internal global ptr @a, align 834; OLDAPI_SRC-NEXT: @a = dso_local global i32 42, align 435; OLDAPI_DST: @b = external dso_local global ptr36; OLDAPI_DST-NEXT: @a = available_externally dso_local global i32 42, align 437; OLDAPI_DST_DSO: @b = external global ptr38; OLDAPI_DST_DSO-NEXT: @a = available_externally global i32 42, align 439 40target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"41target triple = "x86_64-unknown-linux-gnu"42 43@a = external global i3244@b = external global ptr45 46define i32 @main() {47 %p = load ptr, ptr @b, align 8 48 store i32 33, ptr %p, align 449 %v = load i32, ptr @a, align 450 ret i32 %v51}52