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 -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
7
8; No variable in the source module should have been internalized
9; SRC:      @b = dso_local global i32* @a
10; SRC-NEXT: @a = dso_local global i32 42
11
12; We can't internalize globals referenced by other live globals
13; DEST:      @b = external dso_local global i32*
14; DEST-NEXT: @a = available_externally dso_local global i32 42, align 4
15
16target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
17target triple = "x86_64-unknown-linux-gnu"
18
19@a = external global i32
20@b = external global i32*
21
22define i32 @main() {
23  %p = load i32*, i32** @b, align 8
24  store i32 33, i32* %p, align 4
25  %v = load i32, i32* @a, align 4
26  ret i32 %v
27}
28