[llvm-branch-commits] [llvm] 2262b04 - [test] Add explicit dso_local to constant/global variable declarations

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Dec 4 13:56:49 PST 2020


Author: Fangrui Song
Date: 2020-12-04T13:51:01-08:00
New Revision: 2262b04cab76c82187e234eca870c0c5c776be0a

URL: https://github.com/llvm/llvm-project/commit/2262b04cab76c82187e234eca870c0c5c776be0a
DIFF: https://github.com/llvm/llvm-project/commit/2262b04cab76c82187e234eca870c0c5c776be0a.diff

LOG: [test] Add explicit dso_local to constant/global variable declarations

They are currently implicit because TargetMachine::shouldAssumeDSOLocal implies
dso_local.

For external data, clang -fno-pic emits the dso_local specifier for ELF and
non-MinGW COFF. Adding explicit dso_local makes these tests in align with the
clang behavior and helps implementing an option to use GOT indirection for
external data access in -fno-pic mode (to avoid copy relocations).

Added: 
    llvm/test/tools/gold/X86/relocation-model-static.ll

Modified: 
    llvm/test/CodeGen/AArch64/arm64-bitfield-extract.ll
    llvm/test/CodeGen/AArch64/arm64-csldst-mmo.ll
    llvm/test/CodeGen/AArch64/arm64-memcpy-inline.ll
    llvm/test/CodeGen/AArch64/ghc-cc.ll
    llvm/test/CodeGen/AArch64/global-alignment.ll
    llvm/test/CodeGen/AArch64/ldradr.ll
    llvm/test/CodeGen/AArch64/merge-store.ll
    llvm/test/CodeGen/SystemZ/ghc-cc-01.ll
    llvm/test/CodeGen/SystemZ/ipra.ll
    llvm/test/CodeGen/SystemZ/la-01.ll
    llvm/test/CodeGen/SystemZ/memcpy-02.ll
    llvm/test/CodeGen/SystemZ/subregliveness-01.ll
    llvm/test/CodeGen/SystemZ/subregliveness-05.ll
    llvm/test/CodeGen/WebAssembly/offset-folding.ll
    llvm/test/CodeGen/X86/2005-01-17-CycleInDAG.ll
    llvm/test/CodeGen/X86/2006-01-19-ISelFoldingBug.ll
    llvm/test/CodeGen/X86/2006-05-02-InstrSched1.ll
    llvm/test/CodeGen/X86/2006-05-08-CoalesceSubRegClass.ll
    llvm/test/CodeGen/X86/2006-05-08-InstrSched.ll
    llvm/test/CodeGen/X86/2006-10-10-FindModifiedNodeSlotBug.ll
    llvm/test/CodeGen/X86/2006-10-13-CycleInDAG.ll
    llvm/test/CodeGen/X86/2007-05-05-VecCastExpand.ll
    llvm/test/CodeGen/X86/2008-02-05-ISelCrash.ll
    llvm/test/CodeGen/X86/2008-04-24-MemCpyBug.ll
    llvm/test/CodeGen/X86/2008-07-19-movups-spills.ll
    llvm/test/CodeGen/X86/2008-07-22-CombinerCrash.ll
    llvm/test/CodeGen/X86/2008-09-11-CoalescerBug.ll
    llvm/test/CodeGen/X86/2008-09-11-CoalescerBug2.ll
    llvm/test/CodeGen/X86/2008-12-02-IllegalResultType.ll
    llvm/test/CodeGen/X86/2008-12-23-crazy-address.ll
    llvm/test/CodeGen/X86/2009-02-03-AnalyzedTwice.ll
    llvm/test/CodeGen/X86/2009-03-23-MultiUseSched.ll
    llvm/test/CodeGen/X86/2009-04-12-picrel.ll
    llvm/test/CodeGen/X86/2009-08-19-LoadNarrowingMiscompile.ll
    llvm/test/CodeGen/X86/2009-08-23-SubRegReuseUndo.ll
    llvm/test/CodeGen/X86/2009-10-19-atomic-cmp-eflags.ll
    llvm/test/CodeGen/X86/2009-11-18-TwoAddrKill.ll
    llvm/test/CodeGen/X86/2010-07-15-Crash.ll
    llvm/test/CodeGen/X86/2010-11-18-SelectOfExtload.ll
    llvm/test/CodeGen/X86/2012-01-16-mfence-nosse-flags.ll
    llvm/test/CodeGen/X86/atom-call-reg-indirect-foldedreload32.ll
    llvm/test/CodeGen/X86/atom-call-reg-indirect-foldedreload64.ll
    llvm/test/CodeGen/X86/atom-call-reg-indirect.ll
    llvm/test/CodeGen/X86/atomic-minmax-i6432.ll
    llvm/test/CodeGen/X86/atomic-unordered.ll
    llvm/test/CodeGen/X86/atomic16.ll
    llvm/test/CodeGen/X86/atomic32.ll
    llvm/test/CodeGen/X86/atomic64.ll
    llvm/test/CodeGen/X86/atomic6432.ll
    llvm/test/CodeGen/X86/atomic8.ll
    llvm/test/CodeGen/X86/avoid-loop-align-2.ll
    llvm/test/CodeGen/X86/basic-block-sections-eh.ll
    llvm/test/CodeGen/X86/bug37521.ll
    llvm/test/CodeGen/X86/callbr-asm-blockplacement.ll
    llvm/test/CodeGen/X86/cmov.ll
    llvm/test/CodeGen/X86/cmpxchg8b_alloca_regalloc_handling.ll
    llvm/test/CodeGen/X86/code_placement.ll
    llvm/test/CodeGen/X86/codegen-prepare-cast.ll
    llvm/test/CodeGen/X86/codemodel.ll
    llvm/test/CodeGen/X86/commute-two-addr.ll
    llvm/test/CodeGen/X86/divrem8_ext.ll
    llvm/test/CodeGen/X86/dollar-name.ll
    llvm/test/CodeGen/X86/extractps.ll
    llvm/test/CodeGen/X86/fastcc-sret.ll
    llvm/test/CodeGen/X86/fold-load.ll
    llvm/test/CodeGen/X86/fold-mul-lohi.ll
    llvm/test/CodeGen/X86/fold-rmw-ops.ll
    llvm/test/CodeGen/X86/fold-sext-trunc.ll
    llvm/test/CodeGen/X86/fold-vector-bv-crash.ll
    llvm/test/CodeGen/X86/ghc-cc.ll
    llvm/test/CodeGen/X86/ghc-cc64.ll
    llvm/test/CodeGen/X86/hipe-cc.ll
    llvm/test/CodeGen/X86/inline-asm-out-regs.ll
    llvm/test/CodeGen/X86/keylocker-intrinsics.ll
    llvm/test/CodeGen/X86/lea-opt.ll
    llvm/test/CodeGen/X86/lsr-i386.ll
    llvm/test/CodeGen/X86/lsr-interesting-step.ll
    llvm/test/CodeGen/X86/lsr-static-addr.ll
    llvm/test/CodeGen/X86/lvi-hardening-indirectbr.ll
    llvm/test/CodeGen/X86/machine-cse.ll
    llvm/test/CodeGen/X86/merge-consecutive-loads-256.ll
    llvm/test/CodeGen/X86/movtopush.ll
    llvm/test/CodeGen/X86/movtopush64.ll
    llvm/test/CodeGen/X86/mul128.ll
    llvm/test/CodeGen/X86/musttail-varargs.ll
    llvm/test/CodeGen/X86/negative-offset.ll
    llvm/test/CodeGen/X86/negative-subscript.ll
    llvm/test/CodeGen/X86/no-sse-x86.ll
    llvm/test/CodeGen/X86/overlap-shift.ll
    llvm/test/CodeGen/X86/packed_struct.ll
    llvm/test/CodeGen/X86/peephole-na-phys-copy-folding.ll
    llvm/test/CodeGen/X86/post-ra-sched.ll
    llvm/test/CodeGen/X86/pr15981.ll
    llvm/test/CodeGen/X86/pr21792.ll
    llvm/test/CodeGen/X86/pr2585.ll
    llvm/test/CodeGen/X86/pr31045.ll
    llvm/test/CodeGen/X86/pr31271.ll
    llvm/test/CodeGen/X86/pr32256.ll
    llvm/test/CodeGen/X86/pr32284.ll
    llvm/test/CodeGen/X86/pr32329.ll
    llvm/test/CodeGen/X86/pr32340.ll
    llvm/test/CodeGen/X86/pr32345.ll
    llvm/test/CodeGen/X86/pr3241.ll
    llvm/test/CodeGen/X86/pr3244.ll
    llvm/test/CodeGen/X86/pr32515.ll
    llvm/test/CodeGen/X86/pr32588.ll
    llvm/test/CodeGen/X86/pr32659.ll
    llvm/test/CodeGen/X86/pr33828.ll
    llvm/test/CodeGen/X86/pr33960.ll
    llvm/test/CodeGen/X86/pr34137.ll
    llvm/test/CodeGen/X86/pr34292.ll
    llvm/test/CodeGen/X86/pr34381.ll
    llvm/test/CodeGen/X86/pr3522.ll
    llvm/test/CodeGen/X86/pr35316.ll
    llvm/test/CodeGen/X86/pr35443.ll
    llvm/test/CodeGen/X86/pr36274.ll
    llvm/test/CodeGen/X86/pr37916.ll
    llvm/test/CodeGen/X86/pr40539.ll
    llvm/test/CodeGen/X86/pr42452.ll
    llvm/test/CodeGen/X86/pr47482.ll
    llvm/test/CodeGen/X86/pr5145.ll
    llvm/test/CodeGen/X86/rd-mod-wr-eflags.ll
    llvm/test/CodeGen/X86/remat-constant.ll
    llvm/test/CodeGen/X86/retpoline-external.ll
    llvm/test/CodeGen/X86/retpoline.ll
    llvm/test/CodeGen/X86/shift-one.ll
    llvm/test/CodeGen/X86/shift-parts.ll
    llvm/test/CodeGen/X86/shl-crash-on-legalize.ll
    llvm/test/CodeGen/X86/shrink_vmul.ll
    llvm/test/CodeGen/X86/shrink_vmul_sse.ll
    llvm/test/CodeGen/X86/sink-hoist.ll
    llvm/test/CodeGen/X86/sink-local-value.ll
    llvm/test/CodeGen/X86/sse2.ll
    llvm/test/CodeGen/X86/sse3.ll
    llvm/test/CodeGen/X86/store-fp-constant.ll
    llvm/test/CodeGen/X86/stride-nine-with-base-reg.ll
    llvm/test/CodeGen/X86/stride-reuse.ll
    llvm/test/CodeGen/X86/tail-merge-identical.ll
    llvm/test/CodeGen/X86/tail-opts.ll
    llvm/test/CodeGen/X86/v4i32load-crash.ll
    llvm/test/CodeGen/X86/vec_zero_cse.ll
    llvm/test/CodeGen/X86/volatile.ll
    llvm/test/CodeGen/X86/x32-function_pointer-1.ll
    llvm/test/CodeGen/X86/x86-64-disp.ll
    llvm/test/CodeGen/XCore/codemodel.ll
    llvm/test/CodeGen/XCore/offset_folding.ll
    llvm/test/DebugInfo/X86/fission-ranges.ll
    llvm/test/Transforms/CodeGenPrepare/X86/sink-addrmode-select.ll
    llvm/test/tools/gold/X86/relocation-model-pic.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/AArch64/arm64-bitfield-extract.ll b/llvm/test/CodeGen/AArch64/arm64-bitfield-extract.ll
index 7b792bc71bbe..567337367f80 100644
--- a/llvm/test/CodeGen/AArch64/arm64-bitfield-extract.ll
+++ b/llvm/test/CodeGen/AArch64/arm64-bitfield-extract.ll
@@ -793,7 +793,7 @@ define i64 @fct18(i32 %xor72) nounwind ssp {
 }
 
 ; Using the access to the global array to keep the instruction and control flow.
- at first_ones = external global [65536 x i8]
+ at first_ones = external dso_local global [65536 x i8]
 
 ; Function Attrs: nounwind readonly ssp
 define i32 @fct19(i64 %arg1) nounwind readonly ssp  {
@@ -965,7 +965,7 @@ end:
 }
 
 ; Check if we can still catch UBFX when "AND" is used by SHL.
- at arr = external global [8 x [64 x i64]]
+ at arr = external dso_local global [8 x [64 x i64]]
 define i64 @fct21(i64 %x) {
 ; LLC-LABEL: fct21:
 ; LLC:       // %bb.0: // %entry

diff  --git a/llvm/test/CodeGen/AArch64/arm64-csldst-mmo.ll b/llvm/test/CodeGen/AArch64/arm64-csldst-mmo.ll
index 40c82ecca3f2..e02a3a8ba7fd 100644
--- a/llvm/test/CodeGen/AArch64/arm64-csldst-mmo.ll
+++ b/llvm/test/CodeGen/AArch64/arm64-csldst-mmo.ll
@@ -2,7 +2,7 @@
 ; RUN: llc < %s -mtriple=arm64-linux-gnu -mcpu=cortex-a57 -enable-misched=0 -debug-only=machine-scheduler -o - 2>&1 > /dev/null | FileCheck %s
 ; REQUIRES: asserts
 
- at G = external global [0 x i32], align 4
+ at G = external dso_local global [0 x i32], align 4
 
 ; Check that MMOs are added to epilogue calle-save restore loads so
 ; that the store to G is not considered dependant on the callee-save

diff  --git a/llvm/test/CodeGen/AArch64/arm64-memcpy-inline.ll b/llvm/test/CodeGen/AArch64/arm64-memcpy-inline.ll
index 9c27d1561c90..5a27cd89250c 100644
--- a/llvm/test/CodeGen/AArch64/arm64-memcpy-inline.ll
+++ b/llvm/test/CodeGen/AArch64/arm64-memcpy-inline.ll
@@ -2,8 +2,8 @@
 
 %struct.x = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 }
 
- at src = external global %struct.x
- at dst = external global %struct.x
+ at src = external dso_local global %struct.x
+ at dst = external dso_local global %struct.x
 
 @.str1 = private unnamed_addr constant [31 x i8] c"DHRYSTONE PROGRAM, SOME STRING\00", align 1
 @.str2 = private unnamed_addr constant [36 x i8] c"DHRYSTONE PROGRAM, SOME STRING BLAH\00", align 1

diff  --git a/llvm/test/CodeGen/AArch64/ghc-cc.ll b/llvm/test/CodeGen/AArch64/ghc-cc.ll
index 01ed78558c79..390cce869fff 100644
--- a/llvm/test/CodeGen/AArch64/ghc-cc.ll
+++ b/llvm/test/CodeGen/AArch64/ghc-cc.ll
@@ -2,26 +2,26 @@
 
 ; Check the GHC call convention works (aarch64)
 
- at base  = external global i64 ; assigned to register: r19
- at sp    = external global i64 ; assigned to register: r20
- at hp    = external global i64 ; assigned to register: r21
- at r1    = external global i64 ; assigned to register: r22
- at r2    = external global i64 ; assigned to register: r23
- at r3    = external global i64 ; assigned to register: r24
- at r4    = external global i64 ; assigned to register: r25
- at r5    = external global i64 ; assigned to register: r26
- at r6    = external global i64 ; assigned to register: r27
- at splim = external global i64 ; assigned to register: r28
+ at base  = external dso_local global i64 ; assigned to register: r19
+ at sp    = external dso_local global i64 ; assigned to register: r20
+ at hp    = external dso_local global i64 ; assigned to register: r21
+ at r1    = external dso_local global i64 ; assigned to register: r22
+ at r2    = external dso_local global i64 ; assigned to register: r23
+ at r3    = external dso_local global i64 ; assigned to register: r24
+ at r4    = external dso_local global i64 ; assigned to register: r25
+ at r5    = external dso_local global i64 ; assigned to register: r26
+ at r6    = external dso_local global i64 ; assigned to register: r27
+ at splim = external dso_local global i64 ; assigned to register: r28
 
- at f1 = external global float  ; assigned to register: s8
- at f2 = external global float  ; assigned to register: s9
- at f3 = external global float  ; assigned to register: s10
- at f4 = external global float  ; assigned to register: s11
+ at f1 = external dso_local global float  ; assigned to register: s8
+ at f2 = external dso_local global float  ; assigned to register: s9
+ at f3 = external dso_local global float  ; assigned to register: s10
+ at f4 = external dso_local global float  ; assigned to register: s11
 
- at d1 = external global double ; assigned to register: d12
- at d2 = external global double ; assigned to register: d13
- at d3 = external global double ; assigned to register: d14
- at d4 = external global double ; assigned to register: d15
+ at d1 = external dso_local global double ; assigned to register: d12
+ at d2 = external dso_local global double ; assigned to register: d13
+ at d3 = external dso_local global double ; assigned to register: d14
+ at d4 = external dso_local global double ; assigned to register: d15
 
 define ghccc i64 @addtwo(i64 %x, i64 %y) nounwind {
 entry:

diff  --git a/llvm/test/CodeGen/AArch64/global-alignment.ll b/llvm/test/CodeGen/AArch64/global-alignment.ll
index 84bf20d67365..ae90df26f6e7 100644
--- a/llvm/test/CodeGen/AArch64/global-alignment.ll
+++ b/llvm/test/CodeGen/AArch64/global-alignment.ll
@@ -60,7 +60,7 @@ define i64 @test_var32_alias() {
   ret i64 %val
 }
 
- at yet_another_var = external global {i32, i32}
+ at yet_another_var = external dso_local global {i32, i32}
 
 define i64 @test_yet_another_var() {
 ; CHECK-LABEL: test_yet_another_var:

diff  --git a/llvm/test/CodeGen/AArch64/ldradr.ll b/llvm/test/CodeGen/AArch64/ldradr.ll
index bd295eac5ec3..2e6ca86e3227 100644
--- a/llvm/test/CodeGen/AArch64/ldradr.ll
+++ b/llvm/test/CodeGen/AArch64/ldradr.ll
@@ -3,12 +3,12 @@
 
 %struct.T = type <{ i32, i64, i8, i32 }>
 
- at ptr = external local_unnamed_addr global i32*, align 8
- at ch = external local_unnamed_addr global i32, align 4
- at ch8 = external local_unnamed_addr global i8, align 4
- at t = external local_unnamed_addr global %struct.T, align 4
- at t2 = external local_unnamed_addr global %struct.T, align 2
- at f = external local_unnamed_addr global float, align 4
+ at ptr = external dso_local local_unnamed_addr global i32*, align 8
+ at ch = external dso_local local_unnamed_addr global i32, align 4
+ at ch8 = external dso_local local_unnamed_addr global i8, align 4
+ at t = external dso_local local_unnamed_addr global %struct.T, align 4
+ at t2 = external dso_local local_unnamed_addr global %struct.T, align 2
+ at f = external dso_local local_unnamed_addr global float, align 4
 
 define i32 @barp() {
 ; CHECK-LABEL: barp:

diff  --git a/llvm/test/CodeGen/AArch64/merge-store.ll b/llvm/test/CodeGen/AArch64/merge-store.ll
index f0a53384cdd8..f780af5374af 100644
--- a/llvm/test/CodeGen/AArch64/merge-store.ll
+++ b/llvm/test/CodeGen/AArch64/merge-store.ll
@@ -2,8 +2,8 @@
 ; RUN: llc < %s -mtriple=aarch64-unknown-unknown -mcpu=cyclone -mattr=+slow-misaligned-128store | FileCheck %s --check-prefixes=CHECK,SPLITTING
 ; RUN: llc < %s -mtriple=aarch64-eabi -mattr=-slow-misaligned-128store | FileCheck %s --check-prefixes=CHECK,MISALIGNED
 
- at g0 = external global <3 x float>, align 16
- at g1 = external global <3 x float>, align 4
+ at g0 = external dso_local global <3 x float>, align 16
+ at g1 = external dso_local global <3 x float>, align 4
 
 define void @blam() {
 ; SPLITTING-LABEL: blam:

diff  --git a/llvm/test/CodeGen/SystemZ/ghc-cc-01.ll b/llvm/test/CodeGen/SystemZ/ghc-cc-01.ll
index dc8052d8f058..9a26dda85d85 100644
--- a/llvm/test/CodeGen/SystemZ/ghc-cc-01.ll
+++ b/llvm/test/CodeGen/SystemZ/ghc-cc-01.ll
@@ -2,32 +2,32 @@
 ;
 ; RUN: llc -mtriple=s390x-ibm-linux < %s | FileCheck %s
 
- at base  = external global i64 ; assigned to register: r7
- at sp    = external global i64 ; assigned to register: r8
- at hp    = external global i64 ; assigned to register: r10
- at r1    = external global i64 ; assigned to register: r11
- at r2    = external global i64 ; assigned to register: r12
- at r3    = external global i64 ; assigned to register: r13
- at r4    = external global i64 ; assigned to register: r6
- at r5    = external global i64 ; assigned to register: r2
- at r6    = external global i64 ; assigned to register: r3
- at r7    = external global i64 ; assigned to register: r4
- at r8    = external global i64 ; assigned to register: r5
- at splim = external global i64 ; assigned to register: r9
+ at base  = external dso_local global i64 ; assigned to register: r7
+ at sp    = external dso_local global i64 ; assigned to register: r8
+ at hp    = external dso_local global i64 ; assigned to register: r10
+ at r1    = external dso_local global i64 ; assigned to register: r11
+ at r2    = external dso_local global i64 ; assigned to register: r12
+ at r3    = external dso_local global i64 ; assigned to register: r13
+ at r4    = external dso_local global i64 ; assigned to register: r6
+ at r5    = external dso_local global i64 ; assigned to register: r2
+ at r6    = external dso_local global i64 ; assigned to register: r3
+ at r7    = external dso_local global i64 ; assigned to register: r4
+ at r8    = external dso_local global i64 ; assigned to register: r5
+ at splim = external dso_local global i64 ; assigned to register: r9
 
- at f1 = external global float  ; assigned to register: s8
- at f2 = external global float  ; assigned to register: s9
- at f3 = external global float  ; assigned to register: s10
- at f4 = external global float  ; assigned to register: s11
- at f5 = external global float  ; assigned to register: s0
- at f6 = external global float  ; assigned to register: s1
+ at f1 = external dso_local global float  ; assigned to register: s8
+ at f2 = external dso_local global float  ; assigned to register: s9
+ at f3 = external dso_local global float  ; assigned to register: s10
+ at f4 = external dso_local global float  ; assigned to register: s11
+ at f5 = external dso_local global float  ; assigned to register: s0
+ at f6 = external dso_local global float  ; assigned to register: s1
 
- at d1 = external global double ; assigned to register: d12
- at d2 = external global double ; assigned to register: d13
- at d3 = external global double ; assigned to register: d14
- at d4 = external global double ; assigned to register: d15
- at d5 = external global double ; assigned to register: d2
- at d6 = external global double ; assigned to register: d3
+ at d1 = external dso_local global double ; assigned to register: d12
+ at d2 = external dso_local global double ; assigned to register: d13
+ at d3 = external dso_local global double ; assigned to register: d14
+ at d4 = external dso_local global double ; assigned to register: d15
+ at d5 = external dso_local global double ; assigned to register: d2
+ at d6 = external dso_local global double ; assigned to register: d3
 
 define ghccc void @foo() nounwind {
 entry:

diff  --git a/llvm/test/CodeGen/SystemZ/ipra.ll b/llvm/test/CodeGen/SystemZ/ipra.ll
index 42bfcccc0cb2..951b2d945bde 100644
--- a/llvm/test/CodeGen/SystemZ/ipra.ll
+++ b/llvm/test/CodeGen/SystemZ/ipra.ll
@@ -8,8 +8,8 @@
 ;
 ; CHECK: fn2 Clobbered Registers: {{.*}} $r0h
 
- at h = external global [0 x i32], align 4
- at n = external global i32*, align 8
+ at h = external dso_local global [0 x i32], align 4
+ at n = external dso_local global i32*, align 8
 
 define void @fn1() {
 bb:

diff  --git a/llvm/test/CodeGen/SystemZ/la-01.ll b/llvm/test/CodeGen/SystemZ/la-01.ll
index 31d204125170..303d057ea0ff 100644
--- a/llvm/test/CodeGen/SystemZ/la-01.ll
+++ b/llvm/test/CodeGen/SystemZ/la-01.ll
@@ -3,11 +3,11 @@
 ;
 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
 
- at e4 = external global i32
+ at e4 = external dso_local global i32
 @d4 = global i32 1
- at e2 = external global i32, align 2
+ at e2 = external dso_local global i32, align 2
 @d2 = global i32 1, align 2
- at e1 = external global i32, align 1
+ at e1 = external dso_local global i32, align 1
 @d1 = global i32 1, align 1
 
 declare void @ef()

diff  --git a/llvm/test/CodeGen/SystemZ/memcpy-02.ll b/llvm/test/CodeGen/SystemZ/memcpy-02.ll
index bb676eceae19..f86ad50b79a7 100644
--- a/llvm/test/CodeGen/SystemZ/memcpy-02.ll
+++ b/llvm/test/CodeGen/SystemZ/memcpy-02.ll
@@ -8,8 +8,8 @@
 @g2dst = global i16 2
 @g3 = global i32 3
 @g4 = global i64 4
- at g5src = external global fp128, align 16
- at g5dst = external global fp128, align 16
+ at g5src = external dso_local global fp128, align 16
+ at g5dst = external dso_local global fp128, align 16
 
 ; Test the simple i8 case.
 define void @f1(i8 *%ptr1) {

diff  --git a/llvm/test/CodeGen/SystemZ/subregliveness-01.ll b/llvm/test/CodeGen/SystemZ/subregliveness-01.ll
index 15bb014930ab..83a357900c39 100644
--- a/llvm/test/CodeGen/SystemZ/subregliveness-01.ll
+++ b/llvm/test/CodeGen/SystemZ/subregliveness-01.ll
@@ -6,8 +6,8 @@
 target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
 target triple = "s390x-ibm-linux"
 
- at g_439 = external global i32, align 4
- at g_399 = external global { i8, i8, i8, i8, i8, i8 }, align 8
+ at g_439 = external dso_local global i32, align 4
+ at g_399 = external dso_local global { i8, i8, i8, i8, i8, i8 }, align 8
 
 ; Function Attrs: nounwind
 define void @main() #0 {

diff  --git a/llvm/test/CodeGen/SystemZ/subregliveness-05.ll b/llvm/test/CodeGen/SystemZ/subregliveness-05.ll
index a143852428fd..da1e37d6e740 100644
--- a/llvm/test/CodeGen/SystemZ/subregliveness-05.ll
+++ b/llvm/test/CodeGen/SystemZ/subregliveness-05.ll
@@ -6,7 +6,7 @@
 target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64"
 target triple = "s390x-ibm-linux"
 
- at g_65 = external global i32, align 4
+ at g_65 = external dso_local global i32, align 4
 
 ; Function Attrs: nounwind
 define void @main(i1 %x) #0 {

diff  --git a/llvm/test/CodeGen/WebAssembly/offset-folding.ll b/llvm/test/CodeGen/WebAssembly/offset-folding.ll
index 54a8636b53e2..79ebafbb9007 100644
--- a/llvm/test/CodeGen/WebAssembly/offset-folding.ll
+++ b/llvm/test/CodeGen/WebAssembly/offset-folding.ll
@@ -5,7 +5,7 @@
 target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
 target triple = "wasm32-unknown-unknown"
 
- at x = external global [0 x i32]
+ at x = external dso_local global [0 x i32]
 @y = global [50 x i32] zeroinitializer
 
 ; Test basic constant offsets of both defined and external symbols.

diff  --git a/llvm/test/CodeGen/X86/2005-01-17-CycleInDAG.ll b/llvm/test/CodeGen/X86/2005-01-17-CycleInDAG.ll
index 1f9f2c6240da..97d8ff5ac128 100644
--- a/llvm/test/CodeGen/X86/2005-01-17-CycleInDAG.ll
+++ b/llvm/test/CodeGen/X86/2005-01-17-CycleInDAG.ll
@@ -5,7 +5,7 @@
 
 ; RUN: llc < %s -mtriple=i686-- | FileCheck %s
 
- at GLOBAL = external global i32
+ at GLOBAL = external dso_local global i32
 
 define i32 @test(i32* %P1, i32* %P2, i32* %P3) nounwind {
 ; CHECK-LABEL: test:

diff  --git a/llvm/test/CodeGen/X86/2006-01-19-ISelFoldingBug.ll b/llvm/test/CodeGen/X86/2006-01-19-ISelFoldingBug.ll
index 288e2921daae..fc57d506147e 100644
--- a/llvm/test/CodeGen/X86/2006-01-19-ISelFoldingBug.ll
+++ b/llvm/test/CodeGen/X86/2006-01-19-ISelFoldingBug.ll
@@ -6,7 +6,7 @@
 
 target triple = "i686-unknown-unknown"
 
- at A = external global i32
+ at A = external dso_local global i32
 
 define i32 @test5(i32 %B, i8 %C) {
 ; CHECK-LABEL: test5:

diff  --git a/llvm/test/CodeGen/X86/2006-05-02-InstrSched1.ll b/llvm/test/CodeGen/X86/2006-05-02-InstrSched1.ll
index acd32e49e60d..5600ffa88eca 100644
--- a/llvm/test/CodeGen/X86/2006-05-02-InstrSched1.ll
+++ b/llvm/test/CodeGen/X86/2006-05-02-InstrSched1.ll
@@ -5,8 +5,8 @@
 ; It's possible to schedule this in 14 instructions by avoiding
 ; callee-save registers, but the scheduler isn't currently that
 ; conervative with registers.
- at size20 = external global i32		; <i32*> [#uses=1]
- at in5 = external global i8*		; <i8**> [#uses=1]
+ at size20 = external dso_local global i32		; <i32*> [#uses=1]
+ at in5 = external dso_local global i8*		; <i8**> [#uses=1]
 
 define i32 @compare(i8* %a, i8* %b) nounwind {
 	%tmp = bitcast i8* %a to i32*		; <i32*> [#uses=1]

diff  --git a/llvm/test/CodeGen/X86/2006-05-08-CoalesceSubRegClass.ll b/llvm/test/CodeGen/X86/2006-05-08-CoalesceSubRegClass.ll
index 25bed30ccb53..ad2cf25339bb 100644
--- a/llvm/test/CodeGen/X86/2006-05-08-CoalesceSubRegClass.ll
+++ b/llvm/test/CodeGen/X86/2006-05-08-CoalesceSubRegClass.ll
@@ -4,8 +4,8 @@
 
 ; RUN: llc < %s -mtriple=i686-- -relocation-model=static | FileCheck %s
 
- at B = external global i32		; <i32*> [#uses=2]
- at C = external global i16*		; <i16**> [#uses=2]
+ at B = external dso_local global i32		; <i32*> [#uses=2]
+ at C = external dso_local global i16*		; <i16**> [#uses=2]
 
 define void @test(i32 %A) {
 ; CHECK-LABEL: test:

diff  --git a/llvm/test/CodeGen/X86/2006-05-08-InstrSched.ll b/llvm/test/CodeGen/X86/2006-05-08-InstrSched.ll
index dfa003a8f093..49478c593a7a 100644
--- a/llvm/test/CodeGen/X86/2006-05-08-InstrSched.ll
+++ b/llvm/test/CodeGen/X86/2006-05-08-InstrSched.ll
@@ -1,9 +1,9 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=i686-- -relocation-model=static | FileCheck %s
 
- at A = external global i16*		; <i16**> [#uses=1]
- at B = external global i32		; <i32*> [#uses=1]
- at C = external global i32		; <i32*> [#uses=2]
+ at A = external dso_local global i16*		; <i16**> [#uses=1]
+ at B = external dso_local global i32		; <i32*> [#uses=1]
+ at C = external dso_local global i32		; <i32*> [#uses=2]
 
 define void @test() {
 ; CHECK-LABEL: test:

diff  --git a/llvm/test/CodeGen/X86/2006-10-10-FindModifiedNodeSlotBug.ll b/llvm/test/CodeGen/X86/2006-10-10-FindModifiedNodeSlotBug.ll
index 09ad58abb4f7..0bb920ff24a5 100644
--- a/llvm/test/CodeGen/X86/2006-10-10-FindModifiedNodeSlotBug.ll
+++ b/llvm/test/CodeGen/X86/2006-10-10-FindModifiedNodeSlotBug.ll
@@ -2,7 +2,7 @@
 ; RUN: llc < %s -mtriple=i686-- | FileCheck %s
 ; Bug in FindModifiedNodeSlot cause tmp14 load to become a zextload and shr 31
 ; is then optimized away.
- at tree_code_type = external global [0 x i32]		; <[0 x i32]*> [#uses=1]
+ at tree_code_type = external dso_local global [0 x i32]		; <[0 x i32]*> [#uses=1]
 
 define void @copy_if_shared_r() {
 ; CHECK-LABEL: copy_if_shared_r:

diff  --git a/llvm/test/CodeGen/X86/2006-10-13-CycleInDAG.ll b/llvm/test/CodeGen/X86/2006-10-13-CycleInDAG.ll
index 9d2ec80b7958..5c7102be589b 100644
--- a/llvm/test/CodeGen/X86/2006-10-13-CycleInDAG.ll
+++ b/llvm/test/CodeGen/X86/2006-10-13-CycleInDAG.ll
@@ -1,5 +1,5 @@
 ; RUN: llc < %s -mtriple=i686--
- at str = external global [18 x i8]		; <[18 x i8]*> [#uses=1]
+ at str = external dso_local global [18 x i8]		; <[18 x i8]*> [#uses=1]
 
 define void @test() {
 bb.i:

diff  --git a/llvm/test/CodeGen/X86/2007-05-05-VecCastExpand.ll b/llvm/test/CodeGen/X86/2007-05-05-VecCastExpand.ll
index 19b9224cdc07..806472581910 100644
--- a/llvm/test/CodeGen/X86/2007-05-05-VecCastExpand.ll
+++ b/llvm/test/CodeGen/X86/2007-05-05-VecCastExpand.ll
@@ -1,7 +1,7 @@
 ; RUN: llc < %s -mtriple=i686-- -mcpu=i386 -mattr=+sse
 ; PR1371
 
- at str = external global [18 x i8]		; <[18 x i8]*> [#uses=1]
+ at str = external dso_local global [18 x i8]		; <[18 x i8]*> [#uses=1]
 
 define void @test() {
 bb.i:

diff  --git a/llvm/test/CodeGen/X86/2008-02-05-ISelCrash.ll b/llvm/test/CodeGen/X86/2008-02-05-ISelCrash.ll
index a74e7fc6aa41..c41481d71600 100644
--- a/llvm/test/CodeGen/X86/2008-02-05-ISelCrash.ll
+++ b/llvm/test/CodeGen/X86/2008-02-05-ISelCrash.ll
@@ -1,7 +1,7 @@
 ; RUN: llc < %s -mtriple=i686--
 ; PR1975
 
- at nodes = external global i64		; <i64*> [#uses=2]
+ at nodes = external dso_local global i64		; <i64*> [#uses=2]
 
 define fastcc i32 @ab(i32 %alpha, i32 %beta) nounwind  {
 entry:

diff  --git a/llvm/test/CodeGen/X86/2008-04-24-MemCpyBug.ll b/llvm/test/CodeGen/X86/2008-04-24-MemCpyBug.ll
index a450e88b8f75..a931220cb19a 100644
--- a/llvm/test/CodeGen/X86/2008-04-24-MemCpyBug.ll
+++ b/llvm/test/CodeGen/X86/2008-04-24-MemCpyBug.ll
@@ -3,7 +3,7 @@
 ; Don't accidentally add the offset twice for trailing bytes.
 
 	%struct.S63 = type { [63 x i8] }
- at g1s63 = external global %struct.S63		; <%struct.S63*> [#uses=1]
+ at g1s63 = external dso_local global %struct.S63		; <%struct.S63*> [#uses=1]
 
 declare void @test63(%struct.S63* byval(%struct.S63) align 4 ) nounwind
 

diff  --git a/llvm/test/CodeGen/X86/2008-07-19-movups-spills.ll b/llvm/test/CodeGen/X86/2008-07-19-movups-spills.ll
index 052cf97fefe9..58376c410f34 100644
--- a/llvm/test/CodeGen/X86/2008-07-19-movups-spills.ll
+++ b/llvm/test/CodeGen/X86/2008-07-19-movups-spills.ll
@@ -4,38 +4,38 @@
 ; Verify that movups is still generated with an aligned stack for the globals
 ; that must be accessed unaligned
 
- at 0 = external global <4 x float>, align 1	; <<4 x float>*>:0 [#uses=2]
- at 1 = external global <4 x float>, align 1	; <<4 x float>*>:1 [#uses=1]
- at 2 = external global <4 x float>, align 1	; <<4 x float>*>:2 [#uses=1]
- at 3 = external global <4 x float>, align 1	; <<4 x float>*>:3 [#uses=1]
- at 4 = external global <4 x float>, align 1	; <<4 x float>*>:4 [#uses=1]
- at 5 = external global <4 x float>, align 1	; <<4 x float>*>:5 [#uses=1]
- at 6 = external global <4 x float>, align 1	; <<4 x float>*>:6 [#uses=1]
- at 7 = external global <4 x float>, align 1	; <<4 x float>*>:7 [#uses=1]
- at 8 = external global <4 x float>, align 1	; <<4 x float>*>:8 [#uses=1]
- at 9 = external global <4 x float>, align 1	; <<4 x float>*>:9 [#uses=1]
- at 10 = external global <4 x float>, align 1	; <<4 x float>*>:10 [#uses=1]
- at 11 = external global <4 x float>, align 1	; <<4 x float>*>:11 [#uses=1]
- at 12 = external global <4 x float>, align 1	; <<4 x float>*>:12 [#uses=1]
- at 13 = external global <4 x float>, align 1	; <<4 x float>*>:13 [#uses=1]
- at 14 = external global <4 x float>, align 1	; <<4 x float>*>:14 [#uses=1]
- at 15 = external global <4 x float>, align 1	; <<4 x float>*>:15 [#uses=1]
- at 16 = external global <4 x float>, align 1	; <<4 x float>*>:16 [#uses=1]
- at 17 = external global <4 x float>, align 1	; <<4 x float>*>:17 [#uses=1]
- at 18 = external global <4 x float>, align 1	; <<4 x float>*>:18 [#uses=1]
- at 19 = external global <4 x float>, align 1	; <<4 x float>*>:19 [#uses=1]
- at 20 = external global <4 x float>, align 1	; <<4 x float>*>:20 [#uses=1]
- at 21 = external global <4 x float>, align 1	; <<4 x float>*>:21 [#uses=1]
- at 22 = external global <4 x float>, align 1	; <<4 x float>*>:22 [#uses=1]
- at 23 = external global <4 x float>, align 1	; <<4 x float>*>:23 [#uses=1]
- at 24 = external global <4 x float>, align 1	; <<4 x float>*>:24 [#uses=1]
- at 25 = external global <4 x float>, align 1	; <<4 x float>*>:25 [#uses=1]
- at 26 = external global <4 x float>, align 1	; <<4 x float>*>:26 [#uses=1]
- at 27 = external global <4 x float>, align 1	; <<4 x float>*>:27 [#uses=1]
- at 28 = external global <4 x float>, align 1	; <<4 x float>*>:28 [#uses=1]
- at 29 = external global <4 x float>, align 1	; <<4 x float>*>:29 [#uses=1]
- at 30 = external global <4 x float>, align 1	; <<4 x float>*>:30 [#uses=1]
- at 31 = external global <4 x float>, align 1	; <<4 x float>*>:31 [#uses=1]
+ at 0 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:0 [#uses=2]
+ at 1 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:1 [#uses=1]
+ at 2 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:2 [#uses=1]
+ at 3 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:3 [#uses=1]
+ at 4 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:4 [#uses=1]
+ at 5 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:5 [#uses=1]
+ at 6 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:6 [#uses=1]
+ at 7 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:7 [#uses=1]
+ at 8 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:8 [#uses=1]
+ at 9 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:9 [#uses=1]
+ at 10 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:10 [#uses=1]
+ at 11 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:11 [#uses=1]
+ at 12 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:12 [#uses=1]
+ at 13 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:13 [#uses=1]
+ at 14 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:14 [#uses=1]
+ at 15 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:15 [#uses=1]
+ at 16 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:16 [#uses=1]
+ at 17 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:17 [#uses=1]
+ at 18 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:18 [#uses=1]
+ at 19 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:19 [#uses=1]
+ at 20 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:20 [#uses=1]
+ at 21 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:21 [#uses=1]
+ at 22 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:22 [#uses=1]
+ at 23 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:23 [#uses=1]
+ at 24 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:24 [#uses=1]
+ at 25 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:25 [#uses=1]
+ at 26 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:26 [#uses=1]
+ at 27 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:27 [#uses=1]
+ at 28 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:28 [#uses=1]
+ at 29 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:29 [#uses=1]
+ at 30 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:30 [#uses=1]
+ at 31 = external dso_local global <4 x float>, align 1	; <<4 x float>*>:31 [#uses=1]
 
 declare void @abort()
 

diff  --git a/llvm/test/CodeGen/X86/2008-07-22-CombinerCrash.ll b/llvm/test/CodeGen/X86/2008-07-22-CombinerCrash.ll
index 1d142e05b18c..af30f65d4e12 100644
--- a/llvm/test/CodeGen/X86/2008-07-22-CombinerCrash.ll
+++ b/llvm/test/CodeGen/X86/2008-07-22-CombinerCrash.ll
@@ -1,8 +1,8 @@
 ; RUN: llc < %s -mtriple=i686-- -mattr=+sse2
 ; PR2566
 
- at 0 = external global i16		; <i16*>:0 [#uses=1]
- at 1 = external global <4 x i16>		; <<4 x i16>*>:1 [#uses=1]
+ at 0 = external dso_local global i16		; <i16*>:0 [#uses=1]
+ at 1 = external dso_local global <4 x i16>		; <<4 x i16>*>:1 [#uses=1]
 
 declare void @abort()
 

diff  --git a/llvm/test/CodeGen/X86/2008-09-11-CoalescerBug.ll b/llvm/test/CodeGen/X86/2008-09-11-CoalescerBug.ll
index 1822dbebb12b..886c6ea75b46 100644
--- a/llvm/test/CodeGen/X86/2008-09-11-CoalescerBug.ll
+++ b/llvm/test/CodeGen/X86/2008-09-11-CoalescerBug.ll
@@ -1,7 +1,7 @@
 ; RUN: llc < %s -mtriple=i686--
 ; PR2783
 
- at g_15 = external global i16		; <i16*> [#uses=2]
+ at g_15 = external dso_local global i16		; <i16*> [#uses=2]
 
 define i32 @func_3(i32 %p_5) nounwind {
 entry:

diff  --git a/llvm/test/CodeGen/X86/2008-09-11-CoalescerBug2.ll b/llvm/test/CodeGen/X86/2008-09-11-CoalescerBug2.ll
index 245885268b9c..67155f3936fa 100644
--- a/llvm/test/CodeGen/X86/2008-09-11-CoalescerBug2.ll
+++ b/llvm/test/CodeGen/X86/2008-09-11-CoalescerBug2.ll
@@ -3,8 +3,8 @@
 ; RUN: llc -pre-RA-sched=source < %s -mtriple=i686-unknown-linux -mcpu=corei7 | FileCheck %s --check-prefix=SOURCE-SCHED
 ; PR2748
 
- at g_73 = external global i32
- at g_5 = external global i32
+ at g_73 = external dso_local global i32
+ at g_5 = external dso_local global i32
 
 define i32 @func_44(i16 signext %p_46) nounwind {
 ; SOURCE-SCHED-LABEL: func_44:

diff  --git a/llvm/test/CodeGen/X86/2008-12-02-IllegalResultType.ll b/llvm/test/CodeGen/X86/2008-12-02-IllegalResultType.ll
index c828879e6b99..2c0a211b6a22 100644
--- a/llvm/test/CodeGen/X86/2008-12-02-IllegalResultType.ll
+++ b/llvm/test/CodeGen/X86/2008-12-02-IllegalResultType.ll
@@ -2,8 +2,8 @@
 ; PR3117
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
 target triple = "i386-pc-linux-gnu"
- at g_118 = external global i8		; <i8*> [#uses=1]
- at g_7 = external global i32		; <i32*> [#uses=1]
+ at g_118 = external dso_local global i8		; <i8*> [#uses=1]
+ at g_7 = external dso_local global i32		; <i32*> [#uses=1]
 
 define i32 @func_73(i32 %p_74) nounwind {
 entry:

diff  --git a/llvm/test/CodeGen/X86/2008-12-23-crazy-address.ll b/llvm/test/CodeGen/X86/2008-12-23-crazy-address.ll
index de13fb5ea93a..b7e733ec4fe6 100644
--- a/llvm/test/CodeGen/X86/2008-12-23-crazy-address.ll
+++ b/llvm/test/CodeGen/X86/2008-12-23-crazy-address.ll
@@ -1,7 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=i686-- -relocation-model=static | FileCheck %s
 
- at X = external global [0 x i32]
+ at X = external dso_local global [0 x i32]
 
 define void @foo() nounwind {
 ; CHECK-LABEL: foo:

diff  --git a/llvm/test/CodeGen/X86/2009-02-03-AnalyzedTwice.ll b/llvm/test/CodeGen/X86/2009-02-03-AnalyzedTwice.ll
index a18275a8fc8f..661cf778bd4c 100644
--- a/llvm/test/CodeGen/X86/2009-02-03-AnalyzedTwice.ll
+++ b/llvm/test/CodeGen/X86/2009-02-03-AnalyzedTwice.ll
@@ -3,7 +3,7 @@
 
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
 target triple = "i386-pc-linux-gnu"
- at g_3 = external global i32		; <i32*> [#uses=1]
+ at g_3 = external dso_local global i32		; <i32*> [#uses=1]
 
 define void @bar(i64 %p_66) nounwind {
 entry:

diff  --git a/llvm/test/CodeGen/X86/2009-03-23-MultiUseSched.ll b/llvm/test/CodeGen/X86/2009-03-23-MultiUseSched.ll
index 28564ce2d237..5c303f7181e0 100644
--- a/llvm/test/CodeGen/X86/2009-03-23-MultiUseSched.ll
+++ b/llvm/test/CodeGen/X86/2009-03-23-MultiUseSched.ll
@@ -5,7 +5,7 @@
 ; The register-pressure scheduler should be able to schedule this in a
 ; way that does not require spills.
 
- at X = external global i64		; <i64*> [#uses=25]
+ at X = external dso_local global i64		; <i64*> [#uses=25]
 
 define fastcc i64 @foo() nounwind {
 ; CHECK-LABEL: foo:

diff  --git a/llvm/test/CodeGen/X86/2009-04-12-picrel.ll b/llvm/test/CodeGen/X86/2009-04-12-picrel.ll
index 319fc9303a2b..ce875e5cee7c 100644
--- a/llvm/test/CodeGen/X86/2009-04-12-picrel.ll
+++ b/llvm/test/CodeGen/X86/2009-04-12-picrel.ll
@@ -1,8 +1,8 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -relocation-model=static -code-model=small | FileCheck %s
 
- at dst = external global [131072 x i32]
- at ptr = external global i32*
+ at dst = external dso_local global [131072 x i32]
+ at ptr = external dso_local global i32*
 
 define void @off01(i64 %i) nounwind {
 ; CHECK-LABEL: off01:

diff  --git a/llvm/test/CodeGen/X86/2009-08-19-LoadNarrowingMiscompile.ll b/llvm/test/CodeGen/X86/2009-08-19-LoadNarrowingMiscompile.ll
index 058ffcf152e1..2715a3111b85 100644
--- a/llvm/test/CodeGen/X86/2009-08-19-LoadNarrowingMiscompile.ll
+++ b/llvm/test/CodeGen/X86/2009-08-19-LoadNarrowingMiscompile.ll
@@ -1,7 +1,7 @@
 ; RUN: llc < %s -mtriple=i386-pc-linux | FileCheck %s
 
- at a = external global i96, align 4
- at b = external global i64, align 8
+ at a = external dso_local global i96, align 4
+ at b = external dso_local global i64, align 8
 
 define void @c() nounwind {
 ; CHECK: movl a+8, %eax

diff  --git a/llvm/test/CodeGen/X86/2009-08-23-SubRegReuseUndo.ll b/llvm/test/CodeGen/X86/2009-08-23-SubRegReuseUndo.ll
index 0169de758008..62013ebeb880 100644
--- a/llvm/test/CodeGen/X86/2009-08-23-SubRegReuseUndo.ll
+++ b/llvm/test/CodeGen/X86/2009-08-23-SubRegReuseUndo.ll
@@ -3,7 +3,7 @@
 
 ; This function has a sub-register reuse undone.
 
- at uint8 = external global i32                      ; <i32*> [#uses=3]
+ at uint8 = external dso_local global i32                      ; <i32*> [#uses=3]
 
 declare signext i8 @foo(i32, i8 signext) nounwind readnone
 

diff  --git a/llvm/test/CodeGen/X86/2009-10-19-atomic-cmp-eflags.ll b/llvm/test/CodeGen/X86/2009-10-19-atomic-cmp-eflags.ll
index bca1c0360dc0..dc8405abcc11 100644
--- a/llvm/test/CodeGen/X86/2009-10-19-atomic-cmp-eflags.ll
+++ b/llvm/test/CodeGen/X86/2009-10-19-atomic-cmp-eflags.ll
@@ -4,8 +4,8 @@
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
 target triple = "x86_64-unknown-linux-gnu"
 
- at .str76843 = external constant [45 x i8]          ; <[45 x i8]*> [#uses=1]
- at __profiling_callsite_timestamps_live = external global [1216 x i64] ; <[1216 x i64]*> [#uses=2]
+ at .str76843 = external dso_local constant [45 x i8]          ; <[45 x i8]*> [#uses=1]
+ at __profiling_callsite_timestamps_live = external dso_local global [1216 x i64] ; <[1216 x i64]*> [#uses=2]
 
 define i32 @cl_init(i32 %initoptions) nounwind {
 entry:

diff  --git a/llvm/test/CodeGen/X86/2009-11-18-TwoAddrKill.ll b/llvm/test/CodeGen/X86/2009-11-18-TwoAddrKill.ll
index 0edaa701cd49..1b8a8d58bff7 100644
--- a/llvm/test/CodeGen/X86/2009-11-18-TwoAddrKill.ll
+++ b/llvm/test/CodeGen/X86/2009-11-18-TwoAddrKill.ll
@@ -3,7 +3,7 @@
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
 target triple = "i386-pc-linux-gnu"
 
- at g_296 = external global i8, align 1              ; <i8*> [#uses=1]
+ at g_296 = external dso_local global i8, align 1              ; <i8*> [#uses=1]
 
 define noalias i8** @func_31(i32** nocapture %int8p_33, i8** nocapture %p_34, i8* nocapture %p_35) nounwind {
 entry:

diff  --git a/llvm/test/CodeGen/X86/2010-07-15-Crash.ll b/llvm/test/CodeGen/X86/2010-07-15-Crash.ll
index 857dc3a3610f..819e43fe8621 100644
--- a/llvm/test/CodeGen/X86/2010-07-15-Crash.ll
+++ b/llvm/test/CodeGen/X86/2010-07-15-Crash.ll
@@ -1,7 +1,7 @@
 ; RUN: llc -mtriple=x86_64-unknown-linux-gnu < %s -o /dev/null
 ; PR7653
 
- at __FUNCTION__.1623 = external constant [4 x i8]   ; <[4 x i8]*> [#uses=1]
+ at __FUNCTION__.1623 = external dso_local constant [4 x i8]   ; <[4 x i8]*> [#uses=1]
 
 define void @foo() nounwind {
 entry:

diff  --git a/llvm/test/CodeGen/X86/2010-11-18-SelectOfExtload.ll b/llvm/test/CodeGen/X86/2010-11-18-SelectOfExtload.ll
index 1764922dfd26..43dc2bbf03f4 100644
--- a/llvm/test/CodeGen/X86/2010-11-18-SelectOfExtload.ll
+++ b/llvm/test/CodeGen/X86/2010-11-18-SelectOfExtload.ll
@@ -1,7 +1,7 @@
 ; RUN: llc < %s -mtriple=i686-- -mattr=+cmov | FileCheck %s
 ; Both values were being zero extended.
- at u = external global i8
- at s = external global i8
+ at u = external dso_local global i8
+ at s = external dso_local global i8
 define i32 @foo(i1 %cond) {
 ; CHECK: @foo
   %u_base = load i8, i8* @u

diff  --git a/llvm/test/CodeGen/X86/2012-01-16-mfence-nosse-flags.ll b/llvm/test/CodeGen/X86/2012-01-16-mfence-nosse-flags.ll
index a6c34b8fffa1..8f44b750ed2d 100644
--- a/llvm/test/CodeGen/X86/2012-01-16-mfence-nosse-flags.ll
+++ b/llvm/test/CodeGen/X86/2012-01-16-mfence-nosse-flags.ll
@@ -1,7 +1,7 @@
 ; RUN: llc < %s -verify-machineinstrs -mtriple=i686-linux -mattr=-sse | FileCheck %s
 ; PR11768
 
- at ptr = external global i8*
+ at ptr = external dso_local global i8*
 
 define void @baz() nounwind ssp {
 entry:

diff  --git a/llvm/test/CodeGen/X86/atom-call-reg-indirect-foldedreload32.ll b/llvm/test/CodeGen/X86/atom-call-reg-indirect-foldedreload32.ll
index 2e144f87c338..e04ba90c38a2 100644
--- a/llvm/test/CodeGen/X86/atom-call-reg-indirect-foldedreload32.ll
+++ b/llvm/test/CodeGen/X86/atom-call-reg-indirect-foldedreload32.ll
@@ -20,11 +20,11 @@
 ;     }
 ;   }
 ;
- at sum = external global i32
+ at sum = external dso_local global i32
 @a = common global i32 0, align 4
 @i = common global i32 0, align 4
 @b = common global i32 0, align 4
- at funcp = external global i32 (i32, i32, i32, i32, i32, i32, i32, i32)*
+ at funcp = external dso_local global i32 (i32, i32, i32, i32, i32, i32, i32, i32)*
 @c = common global i32 0, align 4
 @d = common global i32 0, align 4
 @e = common global i32 0, align 4

diff  --git a/llvm/test/CodeGen/X86/atom-call-reg-indirect-foldedreload64.ll b/llvm/test/CodeGen/X86/atom-call-reg-indirect-foldedreload64.ll
index e82626ced206..4a34ef5f50d0 100644
--- a/llvm/test/CodeGen/X86/atom-call-reg-indirect-foldedreload64.ll
+++ b/llvm/test/CodeGen/X86/atom-call-reg-indirect-foldedreload64.ll
@@ -22,11 +22,11 @@
 ;   }
 ;   
 
- at sum = external global i32
+ at sum = external dso_local global i32
 @a = common global i32 0, align 4
 @i = common global i32 0, align 4
 @b = common global i32 0, align 4
- at funcp = external global i32 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32)*
+ at funcp = external dso_local global i32 (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32)*
 @c = common global i32 0, align 4
 @d = common global i32 0, align 4
 @e = common global i32 0, align 4

diff  --git a/llvm/test/CodeGen/X86/atom-call-reg-indirect.ll b/llvm/test/CodeGen/X86/atom-call-reg-indirect.ll
index 8045abc7bad6..c62ab65e5c01 100644
--- a/llvm/test/CodeGen/X86/atom-call-reg-indirect.ll
+++ b/llvm/test/CodeGen/X86/atom-call-reg-indirect.ll
@@ -35,7 +35,7 @@ entry:
 declare %class.A* @_Z3facv() #1
 
 ; virt_fn.ll
- at p = external global void (i32)**
+ at p = external dso_local global void (i32)**
 
 define i32 @test2() #0 {
   ;ATOM-LABEL: test2:

diff  --git a/llvm/test/CodeGen/X86/atomic-minmax-i6432.ll b/llvm/test/CodeGen/X86/atomic-minmax-i6432.ll
index 4eb47c0b82e7..a918f6d2b64f 100644
--- a/llvm/test/CodeGen/X86/atomic-minmax-i6432.ll
+++ b/llvm/test/CodeGen/X86/atomic-minmax-i6432.ll
@@ -2,7 +2,7 @@
 ; RUN: llc -mattr=+cmov -mtriple=i386-pc-linux -verify-machineinstrs < %s | FileCheck %s -check-prefix=LINUX
 ; RUN: llc -mattr=+cmov -mtriple=i386-macosx -relocation-model=pic -verify-machineinstrs < %s | FileCheck %s -check-prefix=PIC
 
- at sc64 = external global i64
+ at sc64 = external dso_local global i64
 
 define i64 @atomic_max_i64() nounwind {
 ; LINUX-LABEL: atomic_max_i64:

diff  --git a/llvm/test/CodeGen/X86/atomic-unordered.ll b/llvm/test/CodeGen/X86/atomic-unordered.ll
index 7b255c7b6c1a..fe34cc3290f9 100644
--- a/llvm/test/CodeGen/X86/atomic-unordered.ll
+++ b/llvm/test/CodeGen/X86/atomic-unordered.ll
@@ -2368,7 +2368,7 @@ define i64 @nofold_stfence(i64* %p) {
 
 ;; Next, test how well we can fold invariant loads.
 
- at Constant = external constant i64
+ at Constant = external dso_local constant i64
 
 define i64 @fold_constant(i64 %arg) {
 ; CHECK-O0-LABEL: fold_constant:

diff  --git a/llvm/test/CodeGen/X86/atomic16.ll b/llvm/test/CodeGen/X86/atomic16.ll
index c96160f9a8f3..5e07fbb365ca 100644
--- a/llvm/test/CodeGen/X86/atomic16.ll
+++ b/llvm/test/CodeGen/X86/atomic16.ll
@@ -1,8 +1,8 @@
 ; RUN: llc < %s -O0 -mtriple=x86_64-unknown-unknown -mcpu=corei7 -verify-machineinstrs -show-mc-encoding | FileCheck %s --check-prefix X64
 ; RUN: llc < %s -O0 -mtriple=i386-unknown-unknown -mcpu=corei7 -verify-machineinstrs | FileCheck %s --check-prefix X32
 
- at sc16 = external global i16
- at fsc16 = external global half
+ at sc16 = external dso_local global i16
+ at fsc16 = external dso_local global half
 
 define void @atomic_fetch_add16() nounwind {
 ; X64-LABEL:   atomic_fetch_add16

diff  --git a/llvm/test/CodeGen/X86/atomic32.ll b/llvm/test/CodeGen/X86/atomic32.ll
index 2e45661ff8d3..565dd13a1bb4 100644
--- a/llvm/test/CodeGen/X86/atomic32.ll
+++ b/llvm/test/CodeGen/X86/atomic32.ll
@@ -4,8 +4,8 @@
 ; RUN: llc < %s -O0 -mtriple=i686-unknown-unknown -mcpu=corei7 -mattr=-cmov,-sse -verify-machineinstrs | FileCheck %s --check-prefixes=X86,X86-NOCMOV
 ; RUN: llc < %s -O0 -mtriple=i686-unknown-unknown -mcpu=corei7 -mattr=-cmov,-sse,-x87 -verify-machineinstrs | FileCheck %s --check-prefixes=X86,X86-NOX87
 
- at sc32 = external global i32
- at fsc32 = external global float
+ at sc32 = external dso_local global i32
+ at fsc32 = external dso_local global float
 
 define void @atomic_fetch_add32() nounwind {
 ; X64-LABEL: atomic_fetch_add32:

diff  --git a/llvm/test/CodeGen/X86/atomic64.ll b/llvm/test/CodeGen/X86/atomic64.ll
index 452bcb254e0d..0e81663020a7 100644
--- a/llvm/test/CodeGen/X86/atomic64.ll
+++ b/llvm/test/CodeGen/X86/atomic64.ll
@@ -2,8 +2,8 @@
 ; RUN: llc < %s -O0 -mtriple=x86_64-- -mcpu=corei7 -verify-machineinstrs | FileCheck %s --check-prefix X64
 ; RUN: llc < %s -O0 -mtriple=i386-- -mcpu=i486 -verify-machineinstrs | FileCheck %s --check-prefix I486
 
- at sc64 = external global i64
- at fsc64 = external global double
+ at sc64 = external dso_local global i64
+ at fsc64 = external dso_local global double
 
 define void @atomic_fetch_add64() nounwind {
 ; X64-LABEL: atomic_fetch_add64:

diff  --git a/llvm/test/CodeGen/X86/atomic6432.ll b/llvm/test/CodeGen/X86/atomic6432.ll
index b83d7ba09ac3..56084399b4b2 100644
--- a/llvm/test/CodeGen/X86/atomic6432.ll
+++ b/llvm/test/CodeGen/X86/atomic6432.ll
@@ -1,7 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -O0 -mtriple=i686-- -mcpu=corei7 -verify-machineinstrs | FileCheck %s --check-prefix X32
 
- at sc64 = external global i64
+ at sc64 = external dso_local global i64
 
 define void @atomic_fetch_add64() nounwind {
 ; X32-LABEL: atomic_fetch_add64:

diff  --git a/llvm/test/CodeGen/X86/atomic8.ll b/llvm/test/CodeGen/X86/atomic8.ll
index c78a919dcb3d..3ac7c4bf0990 100644
--- a/llvm/test/CodeGen/X86/atomic8.ll
+++ b/llvm/test/CodeGen/X86/atomic8.ll
@@ -1,7 +1,7 @@
 ; RUN: llc < %s -O0 -mtriple=x86_64-- -mcpu=corei7 -verify-machineinstrs | FileCheck %s --check-prefix X64
 ; RUN: llc < %s -O0 -mtriple=i686-- -mcpu=corei7 -verify-machineinstrs | FileCheck %s --check-prefix X32
 
- at sc8 = external global i8
+ at sc8 = external dso_local global i8
 
 define void @atomic_fetch_add8() nounwind {
 ; X64-LABEL:   atomic_fetch_add8:

diff  --git a/llvm/test/CodeGen/X86/avoid-loop-align-2.ll b/llvm/test/CodeGen/X86/avoid-loop-align-2.ll
index 7e5927e6ee32..a9a2e4b1d4e2 100644
--- a/llvm/test/CodeGen/X86/avoid-loop-align-2.ll
+++ b/llvm/test/CodeGen/X86/avoid-loop-align-2.ll
@@ -4,7 +4,7 @@
 ; knowing what their trip counts are, or other dynamic information. For
 ; now, CodeGen aligns all loops.
 
- at x = external global i32*		; <i32**> [#uses=1]
+ at x = external dso_local global i32*		; <i32**> [#uses=1]
 
 define i32 @t(i32 %a, i32 %b) nounwind readonly ssp {
 entry:

diff  --git a/llvm/test/CodeGen/X86/basic-block-sections-eh.ll b/llvm/test/CodeGen/X86/basic-block-sections-eh.ll
index 3cc5979d7c0c..f12e0fd386a0 100644
--- a/llvm/test/CodeGen/X86/basic-block-sections-eh.ll
+++ b/llvm/test/CodeGen/X86/basic-block-sections-eh.ll
@@ -1,7 +1,7 @@
 ; Check if landing pads are kept in a separate eh section
 ; RUN: llc < %s -mtriple=i386-unknown-linux-gnu  -function-sections -basic-block-sections=all -unique-basic-block-section-names | FileCheck %s -check-prefix=LINUX-SECTIONS
 
- at _ZTIb = external constant i8*
+ at _ZTIb = external dso_local constant i8*
 define i32 @_Z3foob(i1 zeroext %0) #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
   %2 = alloca i32, align 4
   %3 = alloca i8, align 1

diff  --git a/llvm/test/CodeGen/X86/bug37521.ll b/llvm/test/CodeGen/X86/bug37521.ll
index 14e547acd764..9481fc1cd986 100644
--- a/llvm/test/CodeGen/X86/bug37521.ll
+++ b/llvm/test/CodeGen/X86/bug37521.ll
@@ -1,7 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc -mtriple=x86_64-- < %s | FileCheck %s
 
- at a = external global <16 x float>, align 64
+ at a = external dso_local global <16 x float>, align 64
 
 declare void @goo(<2 x i256>)
 

diff  --git a/llvm/test/CodeGen/X86/callbr-asm-blockplacement.ll b/llvm/test/CodeGen/X86/callbr-asm-blockplacement.ll
index fb658e32d7d2..afadf4ea1328 100644
--- a/llvm/test/CodeGen/X86/callbr-asm-blockplacement.ll
+++ b/llvm/test/CodeGen/X86/callbr-asm-blockplacement.ll
@@ -6,7 +6,7 @@
 %struct.wibble = type { %struct.pluto, i32, i8* }
 %struct.pluto = type { i32, i32, i32 }
 
- at global = external global [0 x %struct.wibble]
+ at global = external dso_local global [0 x %struct.wibble]
 
 define i32 @foo(i32 %arg, i32 (i8*)* %arg3) nounwind {
 ; CHECK-LABEL: foo:

diff  --git a/llvm/test/CodeGen/X86/cmov.ll b/llvm/test/CodeGen/X86/cmov.ll
index b77d3c8e10e0..a014f1253d51 100644
--- a/llvm/test/CodeGen/X86/cmov.ll
+++ b/llvm/test/CodeGen/X86/cmov.ll
@@ -70,10 +70,10 @@ define void @test3(i64 %a, i64 %b, i1 %p) nounwind {
 ; PR4814
 
 
- at g_3 = external global i8
- at g_96 = external global i8
- at g_100 = external global i8
- at _2E_str = external constant [15 x i8], align 1
+ at g_3 = external dso_local global i8
+ at g_96 = external dso_local global i8
+ at g_100 = external dso_local global i8
+ at _2E_str = external dso_local constant [15 x i8], align 1
 
 define i1 @test4() nounwind {
 ; CHECK-LABEL: test4:

diff  --git a/llvm/test/CodeGen/X86/cmpxchg8b_alloca_regalloc_handling.ll b/llvm/test/CodeGen/X86/cmpxchg8b_alloca_regalloc_handling.ll
index 364d78aa3144..ab8265db9c9a 100644
--- a/llvm/test/CodeGen/X86/cmpxchg8b_alloca_regalloc_handling.ll
+++ b/llvm/test/CodeGen/X86/cmpxchg8b_alloca_regalloc_handling.ll
@@ -69,7 +69,7 @@ done:
 ; - base pointer for stack frame (VLA + alignment)
 ; - cmpxchg8b global + index reg
 
- at Counters = external global [19 x i64]
+ at Counters = external dso_local global [19 x i64]
 
 define void @foo_alloca_index_global(i32 %i, i64 %val) {
 entry:

diff  --git a/llvm/test/CodeGen/X86/code_placement.ll b/llvm/test/CodeGen/X86/code_placement.ll
index 270612883a9d..b0376c7704a2 100644
--- a/llvm/test/CodeGen/X86/code_placement.ll
+++ b/llvm/test/CodeGen/X86/code_placement.ll
@@ -1,8 +1,8 @@
 ; RUN: llc -mtriple=i686-- < %s | FileCheck %s
 
- at Te0 = external global [256 x i32]		; <[256 x i32]*> [#uses=5]
- at Te1 = external global [256 x i32]		; <[256 x i32]*> [#uses=4]
- at Te3 = external global [256 x i32]		; <[256 x i32]*> [#uses=2]
+ at Te0 = external dso_local global [256 x i32]		; <[256 x i32]*> [#uses=5]
+ at Te1 = external dso_local global [256 x i32]		; <[256 x i32]*> [#uses=4]
+ at Te3 = external dso_local global [256 x i32]		; <[256 x i32]*> [#uses=2]
 
 ; CHECK: %entry
 ; CHECK: %bb

diff  --git a/llvm/test/CodeGen/X86/codegen-prepare-cast.ll b/llvm/test/CodeGen/X86/codegen-prepare-cast.ll
index 08371d8fa564..30d1d3dead75 100644
--- a/llvm/test/CodeGen/X86/codegen-prepare-cast.ll
+++ b/llvm/test/CodeGen/X86/codegen-prepare-cast.ll
@@ -7,7 +7,7 @@ target datalayout =
 target triple = "x86_64-unknown-linux-gnu"
         %"byte[]" = type { i64, i8* }
         %"char[][]" = type { i64, %"byte[]"* }
- at .str = external constant [7 x i8]              ; <[7 x i8]*> [#uses=1]
+ at .str = external dso_local constant [7 x i8]              ; <[7 x i8]*> [#uses=1]
 
 ; CHECK-LABEL: @_Dmain
 ; CHECK: load i8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0)

diff  --git a/llvm/test/CodeGen/X86/codemodel.ll b/llvm/test/CodeGen/X86/codemodel.ll
index 9aba38ab3a26..1d9818cfeb9f 100644
--- a/llvm/test/CodeGen/X86/codemodel.ll
+++ b/llvm/test/CodeGen/X86/codemodel.ll
@@ -4,7 +4,7 @@
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
 target triple = "x86_64-unknown-linux-gnu"
- at data = external global [0 x i32]		; <[0 x i32]*> [#uses=5]
+ at data = external dso_local global [0 x i32]		; <[0 x i32]*> [#uses=5]
 
 ; CHECK-TINY:    Target does not support the tiny CodeModel
 

diff  --git a/llvm/test/CodeGen/X86/commute-two-addr.ll b/llvm/test/CodeGen/X86/commute-two-addr.ll
index 656c385e2bc7..663bbfa94d89 100644
--- a/llvm/test/CodeGen/X86/commute-two-addr.ll
+++ b/llvm/test/CodeGen/X86/commute-two-addr.ll
@@ -6,7 +6,7 @@
 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 | FileCheck %s -check-prefix=DARWIN
 
 
- at G = external global i32                ; <i32*> [#uses=2]
+ at G = external dso_local global i32                ; <i32*> [#uses=2]
 
 declare void @ext(i32)
 

diff  --git a/llvm/test/CodeGen/X86/divrem8_ext.ll b/llvm/test/CodeGen/X86/divrem8_ext.ll
index e54b357b48e2..a6644b389c98 100644
--- a/llvm/test/CodeGen/X86/divrem8_ext.ll
+++ b/llvm/test/CodeGen/X86/divrem8_ext.ll
@@ -207,4 +207,4 @@ define i64 @pr25754(i8 %a, i8 %c) {
   ret i64 %ret
 }
 
- at z = external global i8
+ at z = external dso_local global i8

diff  --git a/llvm/test/CodeGen/X86/dollar-name.ll b/llvm/test/CodeGen/X86/dollar-name.ll
index 78ca900c2b89..2efc5a60bd3c 100644
--- a/llvm/test/CodeGen/X86/dollar-name.ll
+++ b/llvm/test/CodeGen/X86/dollar-name.ll
@@ -2,7 +2,7 @@
 ; PR1339
 
 @"$bar" = global i32 zeroinitializer
-@"$qux" = external global i32
+@"$qux" = external dso_local global i32
 
 define i32 @"$foo"() nounwind {
 ; CHECK: movl	($bar),

diff  --git a/llvm/test/CodeGen/X86/extractps.ll b/llvm/test/CodeGen/X86/extractps.ll
index ca4a47a420c2..5d1fa1fab96d 100644
--- a/llvm/test/CodeGen/X86/extractps.ll
+++ b/llvm/test/CodeGen/X86/extractps.ll
@@ -2,7 +2,7 @@
 ; RUN: llc < %s -mtriple=i686-- -mcpu=penryn | FileCheck %s
 ; PR2647
 
- at 0 = external global float, align 16         ; <float*>:0 [#uses=2]
+ at 0 = external dso_local global float, align 16         ; <float*>:0 [#uses=2]
 
 define internal void @a() nounwind {
 ; CHECK-LABEL: a:

diff  --git a/llvm/test/CodeGen/X86/fastcc-sret.ll b/llvm/test/CodeGen/X86/fastcc-sret.ll
index ce715b68b642..7060bccb6e14 100644
--- a/llvm/test/CodeGen/X86/fastcc-sret.ll
+++ b/llvm/test/CodeGen/X86/fastcc-sret.ll
@@ -12,7 +12,7 @@ entry:
 ; CHECK: bar
 ; CHECK: ret{{[^4]*$}}
 
- at dst = external global i32
+ at dst = external dso_local global i32
 
 define void @foo() nounwind {
 	%memtmp = alloca %struct.foo, align 4

diff  --git a/llvm/test/CodeGen/X86/fold-load.ll b/llvm/test/CodeGen/X86/fold-load.ll
index 263ad72ebc14..aad38c1620b4 100644
--- a/llvm/test/CodeGen/X86/fold-load.ll
+++ b/llvm/test/CodeGen/X86/fold-load.ll
@@ -2,7 +2,7 @@
 ; RUN: llc < %s -mcpu=generic -mtriple=i686-- | FileCheck %s
 	%struct._obstack_chunk = type { i8*, %struct._obstack_chunk*, [4 x i8] }
 	%struct.obstack = type { i32, %struct._obstack_chunk*, i8*, i8*, i8*, i32, i32, %struct._obstack_chunk* (...)*, void (...)*, i8*, i8 }
- at stmt_obstack = external global %struct.obstack		; <%struct.obstack*> [#uses=1]
+ at stmt_obstack = external dso_local global %struct.obstack		; <%struct.obstack*> [#uses=1]
 
 ; This should just not crash.
 define void @test1() nounwind {

diff  --git a/llvm/test/CodeGen/X86/fold-mul-lohi.ll b/llvm/test/CodeGen/X86/fold-mul-lohi.ll
index f0f6849a32fd..a23c286fa3fe 100644
--- a/llvm/test/CodeGen/X86/fold-mul-lohi.ll
+++ b/llvm/test/CodeGen/X86/fold-mul-lohi.ll
@@ -2,9 +2,9 @@
 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s
 ; CHECK-NOT: lea
 
- at B = external global [1000 x i8], align 32
- at A = external global [1000 x i8], align 32
- at P = external global [1000 x i8], align 32
+ at B = external dso_local global [1000 x i8], align 32
+ at A = external dso_local global [1000 x i8], align 32
+ at P = external dso_local global [1000 x i8], align 32
 
 define void @foo(i32 %m) nounwind {
 entry:

diff  --git a/llvm/test/CodeGen/X86/fold-rmw-ops.ll b/llvm/test/CodeGen/X86/fold-rmw-ops.ll
index 87008b1f43a0..52db7916c27e 100644
--- a/llvm/test/CodeGen/X86/fold-rmw-ops.ll
+++ b/llvm/test/CodeGen/X86/fold-rmw-ops.ll
@@ -3,10 +3,10 @@
 
 target triple = "x86_64-unknown-unknown"
 
- at g64 = external global i64, align 8
- at g32 = external global i32, align 4
- at g16 = external global i16, align 2
- at g8 = external global i8, align 1
+ at g64 = external dso_local global i64, align 8
+ at g32 = external dso_local global i32, align 4
+ at g16 = external dso_local global i16, align 2
+ at g8 = external dso_local global i8, align 1
 
 declare void @a()
 declare void @b()

diff  --git a/llvm/test/CodeGen/X86/fold-sext-trunc.ll b/llvm/test/CodeGen/X86/fold-sext-trunc.ll
index b6af452b3a40..a3a4ee88b648 100644
--- a/llvm/test/CodeGen/X86/fold-sext-trunc.ll
+++ b/llvm/test/CodeGen/X86/fold-sext-trunc.ll
@@ -5,7 +5,7 @@
 %0 = type { i64 }
 %struct.S1 = type { i16, i32 }
 
- at g_10 = external global %struct.S1
+ at g_10 = external dso_local global %struct.S1
 
 declare void @func_28(i64, i64)
 

diff  --git a/llvm/test/CodeGen/X86/fold-vector-bv-crash.ll b/llvm/test/CodeGen/X86/fold-vector-bv-crash.ll
index 8c72afb7e970..ce452be3f3de 100644
--- a/llvm/test/CodeGen/X86/fold-vector-bv-crash.ll
+++ b/llvm/test/CodeGen/X86/fold-vector-bv-crash.ll
@@ -6,7 +6,7 @@
 ; truncation bug from constant folding after legalization.
 ;
 
- at G = external global i32
+ at G = external dso_local global i32
 
 define void @bv_crash_test() {
   %I = insertelement <4 x i64> zeroinitializer, i64 15910, i32 0

diff  --git a/llvm/test/CodeGen/X86/ghc-cc.ll b/llvm/test/CodeGen/X86/ghc-cc.ll
index 1a03c6ae7060..c9ded6c5bb79 100644
--- a/llvm/test/CodeGen/X86/ghc-cc.ll
+++ b/llvm/test/CodeGen/X86/ghc-cc.ll
@@ -2,10 +2,10 @@
 
 ; Test the GHC call convention works (x86-32)
 
- at base = external global i32 ; assigned to register: ebx
- at sp   = external global i32 ; assigned to register: ebp
- at hp   = external global i32 ; assigned to register: edi
- at r1   = external global i32 ; assigned to register: esi
+ at base = external dso_local global i32 ; assigned to register: ebx
+ at sp   = external dso_local global i32 ; assigned to register: ebp
+ at hp   = external dso_local global i32 ; assigned to register: edi
+ at r1   = external dso_local global i32 ; assigned to register: esi
 
 define void @zap(i32 %a, i32 %b) nounwind {
 entry:

diff  --git a/llvm/test/CodeGen/X86/ghc-cc64.ll b/llvm/test/CodeGen/X86/ghc-cc64.ll
index 9abd40bccb40..bed3367e5d18 100644
--- a/llvm/test/CodeGen/X86/ghc-cc64.ll
+++ b/llvm/test/CodeGen/X86/ghc-cc64.ll
@@ -2,23 +2,23 @@
 
 ; Check the GHC call convention works (x86-64)
 
- at base  = external global i64 ; assigned to register: R13
- at sp    = external global i64 ; assigned to register: rbp
- at hp    = external global i64 ; assigned to register: R12
- at r1    = external global i64 ; assigned to register: rbx
- at r2    = external global i64 ; assigned to register: R14
- at r3    = external global i64 ; assigned to register: rsi
- at r4    = external global i64 ; assigned to register: rdi
- at r5    = external global i64 ; assigned to register: R8
- at r6    = external global i64 ; assigned to register: R9
- at splim = external global i64 ; assigned to register: R15
+ at base  = external dso_local global i64 ; assigned to register: R13
+ at sp    = external dso_local global i64 ; assigned to register: rbp
+ at hp    = external dso_local global i64 ; assigned to register: R12
+ at r1    = external dso_local global i64 ; assigned to register: rbx
+ at r2    = external dso_local global i64 ; assigned to register: R14
+ at r3    = external dso_local global i64 ; assigned to register: rsi
+ at r4    = external dso_local global i64 ; assigned to register: rdi
+ at r5    = external dso_local global i64 ; assigned to register: R8
+ at r6    = external dso_local global i64 ; assigned to register: R9
+ at splim = external dso_local global i64 ; assigned to register: R15
 
- at f1 = external global float  ; assigned to register: xmm1
- at f2 = external global float  ; assigned to register: xmm2
- at f3 = external global float  ; assigned to register: xmm3
- at f4 = external global float  ; assigned to register: xmm4
- at d1 = external global double ; assigned to register: xmm5
- at d2 = external global double ; assigned to register: xmm6
+ at f1 = external dso_local global float  ; assigned to register: xmm1
+ at f2 = external dso_local global float  ; assigned to register: xmm2
+ at f3 = external dso_local global float  ; assigned to register: xmm3
+ at f4 = external dso_local global float  ; assigned to register: xmm4
+ at d1 = external dso_local global double ; assigned to register: xmm5
+ at d2 = external dso_local global double ; assigned to register: xmm6
 
 define void @zap(i64 %a, i64 %b) nounwind {
 entry:

diff  --git a/llvm/test/CodeGen/X86/hipe-cc.ll b/llvm/test/CodeGen/X86/hipe-cc.ll
index 86469dad23f2..96a61effaee8 100644
--- a/llvm/test/CodeGen/X86/hipe-cc.ll
+++ b/llvm/test/CodeGen/X86/hipe-cc.ll
@@ -86,6 +86,6 @@ define cc 11 { i32, i32, i32 } @tailcaller(i32 %hp, i32 %p) nounwind {
 !0 = !{ !"P_NSP_LIMIT", i32 84 }
 !1 = !{ !"X86_LEAF_WORDS", i32 24 }
 !2 = !{ !"AMD64_LEAF_WORDS", i32 24 }
- at clos = external constant i32
+ at clos = external dso_local constant i32
 declare cc 11 void @bar(i32, i32, i32, i32, i32)
 declare cc 11 { i32, i32, i32 } @tailcallee(i32, i32, i32, i32, i32, i32)

diff  --git a/llvm/test/CodeGen/X86/inline-asm-out-regs.ll b/llvm/test/CodeGen/X86/inline-asm-out-regs.ll
index 8e47f81a5e06..9ba9cbfa3eef 100644
--- a/llvm/test/CodeGen/X86/inline-asm-out-regs.ll
+++ b/llvm/test/CodeGen/X86/inline-asm-out-regs.ll
@@ -1,8 +1,8 @@
 ; RUN: llc < %s -mtriple=i386-unknown-linux-gnu
 ; PR3391
 
- at pci_indirect = external global { }             ; <{ }*> [#uses=1]
- at pcibios_last_bus = external global i32         ; <i32*> [#uses=2]
+ at pci_indirect = external dso_local global { }             ; <{ }*> [#uses=1]
+ at pcibios_last_bus = external dso_local global i32         ; <i32*> [#uses=2]
 
 define void @pci_pcbios_init() nounwind section ".init.text" {
 entry:

diff  --git a/llvm/test/CodeGen/X86/keylocker-intrinsics.ll b/llvm/test/CodeGen/X86/keylocker-intrinsics.ll
index 2f9797e437b7..15716f3169f8 100644
--- a/llvm/test/CodeGen/X86/keylocker-intrinsics.ll
+++ b/llvm/test/CodeGen/X86/keylocker-intrinsics.ll
@@ -543,7 +543,7 @@ entry:
 
 ; Tests to make sure we can select an appropriate addressing mode for a global.
 
- at foo = external global [64 x i8]
+ at foo = external dso_local global [64 x i8]
 
 define i8 @test_mm_aesenc256kl_u8_global(<2 x i64> %data, <2 x i64>* %out) {
 ; X64-LABEL: test_mm_aesenc256kl_u8_global:

diff  --git a/llvm/test/CodeGen/X86/lea-opt.ll b/llvm/test/CodeGen/X86/lea-opt.ll
index 55dbd02102f5..3241455769d2 100644
--- a/llvm/test/CodeGen/X86/lea-opt.ll
+++ b/llvm/test/CodeGen/X86/lea-opt.ll
@@ -5,8 +5,8 @@
 %struct.anon1 = type { i32, i32, i32 }
 %struct.anon2 = type { i32, [32 x i32], i32 }
 
- at arr1 = external global [65 x %struct.anon1], align 16
- at arr2 = external global [65 x %struct.anon2], align 16
+ at arr1 = external dso_local global [65 x %struct.anon1], align 16
+ at arr2 = external dso_local global [65 x %struct.anon2], align 16
 
 define void @test1(i64 %x) nounwind {
 ; ENABLED-LABEL: test1:

diff  --git a/llvm/test/CodeGen/X86/lsr-i386.ll b/llvm/test/CodeGen/X86/lsr-i386.ll
index c6fba85c9ec7..c63627dc0569 100644
--- a/llvm/test/CodeGen/X86/lsr-i386.ll
+++ b/llvm/test/CodeGen/X86/lsr-i386.ll
@@ -13,7 +13,7 @@ target triple = "i386-pc-linux-gnu"
 
 %struct.anon = type { [72 x i32], i32 }
 
- at mp2grad_ = external global %struct.anon
+ at mp2grad_ = external dso_local global %struct.anon
 
 define void @chomp2g_setup_(i32 %n, i32 %m) nounwind {
 entry:

diff  --git a/llvm/test/CodeGen/X86/lsr-interesting-step.ll b/llvm/test/CodeGen/X86/lsr-interesting-step.ll
index 53f7fb2460c2..c9096156de01 100644
--- a/llvm/test/CodeGen/X86/lsr-interesting-step.ll
+++ b/llvm/test/CodeGen/X86/lsr-interesting-step.ll
@@ -9,7 +9,7 @@
 ; CHECK-NEXT:   cmpq    $8192, %rcx
 ; CHECK-NEXT:   jl
 
- at flags = external global [8192 x i8], align 16 ; <[8192 x i8]*> [#uses=1]
+ at flags = external dso_local global [8192 x i8], align 16 ; <[8192 x i8]*> [#uses=1]
 
 define void @foo() nounwind {
 entry:

diff  --git a/llvm/test/CodeGen/X86/lsr-static-addr.ll b/llvm/test/CodeGen/X86/lsr-static-addr.ll
index 6609c3dc0e62..fc70b984f173 100644
--- a/llvm/test/CodeGen/X86/lsr-static-addr.ll
+++ b/llvm/test/CodeGen/X86/lsr-static-addr.ll
@@ -2,7 +2,7 @@
 ; RUN: llc -mtriple=x86_64-unknown-linux-gnu -relocation-model=static < %s | FileCheck %s --check-prefix=CHECK
 ; RUN: llc -mcpu=atom -mtriple=x86_64-unknown-linux-gnu -relocation-model=static < %s | FileCheck %s --check-prefix=ATOM
 
- at A = external global [0 x double]
+ at A = external dso_local global [0 x double]
 
 define void @foo(i64 %n) nounwind {
 ; CHECK-LABEL: foo:

diff  --git a/llvm/test/CodeGen/X86/lvi-hardening-indirectbr.ll b/llvm/test/CodeGen/X86/lvi-hardening-indirectbr.ll
index d2caf6e1e9eb..41518cd87228 100644
--- a/llvm/test/CodeGen/X86/lvi-hardening-indirectbr.ll
+++ b/llvm/test/CodeGen/X86/lvi-hardening-indirectbr.ll
@@ -36,7 +36,7 @@ entry:
 ; X64FAST:       jmp __llvm_lvi_thunk_r11 # TAILCALL
 
 
- at global_fp = external global void (i32)*
+ at global_fp = external dso_local global void (i32)*
 
 ; Test an indirect call through a global variable.
 define void @icall_global_fp(i32 %x, void (i32)** %fpp) #0 {

diff  --git a/llvm/test/CodeGen/X86/machine-cse.ll b/llvm/test/CodeGen/X86/machine-cse.ll
index 281aaca7c8d1..124928bd7522 100644
--- a/llvm/test/CodeGen/X86/machine-cse.ll
+++ b/llvm/test/CodeGen/X86/machine-cse.ll
@@ -178,7 +178,7 @@ return:
 }
 
 ; PR13578
- at t2_global = external global i32
+ at t2_global = external dso_local global i32
 
 declare i1 @t2_func()
 

diff  --git a/llvm/test/CodeGen/X86/merge-consecutive-loads-256.ll b/llvm/test/CodeGen/X86/merge-consecutive-loads-256.ll
index 15057577c53c..210ad51b0a18 100644
--- a/llvm/test/CodeGen/X86/merge-consecutive-loads-256.ll
+++ b/llvm/test/CodeGen/X86/merge-consecutive-loads-256.ll
@@ -675,7 +675,7 @@ define <16 x i16> @merge_16i16_i16_0uu3zzuuuuuzCuEF_volatile(i16* %ptr) nounwind
 ; Volatile tests.
 ;
 
- at l = external global <32 x i8>, align 32
+ at l = external dso_local global <32 x i8>, align 32
 
 define <2 x i8> @PR42846(<2 x i8>* %j, <2 x i8> %k) {
 ; AVX-LABEL: PR42846:

diff  --git a/llvm/test/CodeGen/X86/movtopush.ll b/llvm/test/CodeGen/X86/movtopush.ll
index ae70919361a1..fa200c2253b9 100644
--- a/llvm/test/CodeGen/X86/movtopush.ll
+++ b/llvm/test/CodeGen/X86/movtopush.ll
@@ -176,7 +176,7 @@ entry:
 ; NORMAL: pushl    $_ext
 ; NORMAL-NEXT: call
 declare void @f(i8*)
- at ext = external constant i8
+ at ext = external dso_local constant i8
 
 define void @test6() {
   call void @f(i8* @ext)
@@ -288,7 +288,7 @@ define void @test10() optsize {
 ; NORMAL-NEXT: pushl [[EAX]]
 ; NORMAL-NEXT: call
 ; NORMAL-NEXT: addl $16, %esp
- at the_global = external global i32
+ at the_global = external dso_local global i32
 define void @test11() optsize {
   %myload = load i32, i32* @the_global
   store i32 42, i32* @the_global

diff  --git a/llvm/test/CodeGen/X86/movtopush64.ll b/llvm/test/CodeGen/X86/movtopush64.ll
index 76dd7402bfac..a59db44043cc 100644
--- a/llvm/test/CodeGen/X86/movtopush64.ll
+++ b/llvm/test/CodeGen/X86/movtopush64.ll
@@ -99,7 +99,7 @@ entry:
 ; NORMAL: pushq $ext
 ; NORMAL: pushq $7
 ; NORMAL: callq ten_params_ptr
- at ext = external constant i8
+ at ext = external dso_local constant i8
 define void @test5() {
 entry:
   call void @ten_params_ptr(i32 1, i64 2, i32 3, i64 4, i32 5, i64 6, i32 7, i8* @ext, i32 9, i64 10)
@@ -157,7 +157,7 @@ entry:
 ; NORMAL: pushq [[REG]]
 ; NORMAL: pushq $7
 ; NORMAL: callq ten_params
- at the_global = external global i64
+ at the_global = external dso_local global i64
 define void @test8() {
   %myload = load i64, i64* @the_global
   store i64 42, i64* @the_global

diff  --git a/llvm/test/CodeGen/X86/mul128.ll b/llvm/test/CodeGen/X86/mul128.ll
index 66d2f3b4eac4..df7e5ddc6aeb 100644
--- a/llvm/test/CodeGen/X86/mul128.ll
+++ b/llvm/test/CodeGen/X86/mul128.ll
@@ -100,8 +100,8 @@ define i128 @foo(i128 %t, i128 %u) {
   ret i128 %k
 }
 
- at aaa = external global i128
- at bbb = external global i128
+ at aaa = external dso_local global i128
+ at bbb = external dso_local global i128
 
 define void @PR13897() nounwind {
 ; X64-LABEL: PR13897:

diff  --git a/llvm/test/CodeGen/X86/musttail-varargs.ll b/llvm/test/CodeGen/X86/musttail-varargs.ll
index f99bdeca019a..34c98dda6010 100644
--- a/llvm/test/CodeGen/X86/musttail-varargs.ll
+++ b/llvm/test/CodeGen/X86/musttail-varargs.ll
@@ -324,7 +324,7 @@ define void @g_thunk(i8* %fptr_i8, ...) {
 
 %struct.Foo = type { i1, i8*, i8* }
 
- at g = external global i32
+ at g = external dso_local global i32
 
 define void @h_thunk(%struct.Foo* %this, ...) {
 ; LINUX-LABEL: h_thunk:

diff  --git a/llvm/test/CodeGen/X86/negative-offset.ll b/llvm/test/CodeGen/X86/negative-offset.ll
index b1789ddc60c1..90b2c89e2d67 100644
--- a/llvm/test/CodeGen/X86/negative-offset.ll
+++ b/llvm/test/CodeGen/X86/negative-offset.ll
@@ -7,7 +7,7 @@ target triple = "x86_64-unknown-linux-gnu"
 ; Test that a constant consisting of a global symbol with a negative offset
 ; is properly folded and isel'd.
 
- at G = external global [8 x i32]
+ at G = external dso_local global [8 x i32]
 define i8* @negative_offset(i8* %a) {
 ; CHECK-LABEL: negative_offset:
 ; CHECK:       # %bb.0:

diff  --git a/llvm/test/CodeGen/X86/negative-subscript.ll b/llvm/test/CodeGen/X86/negative-subscript.ll
index f5dac9c5db15..30de08c19ca1 100644
--- a/llvm/test/CodeGen/X86/negative-subscript.ll
+++ b/llvm/test/CodeGen/X86/negative-subscript.ll
@@ -1,7 +1,7 @@
 ; RUN: llc < %s -mtriple=i686--
 ; rdar://6559995
 
- at a = external global [255 x i8*], align 32
+ at a = external dso_local global [255 x i8*], align 32
 
 define i32 @main() nounwind {
 entry:

diff  --git a/llvm/test/CodeGen/X86/no-sse-x86.ll b/llvm/test/CodeGen/X86/no-sse-x86.ll
index 45fea53af7fb..b3af3161a794 100644
--- a/llvm/test/CodeGen/X86/no-sse-x86.ll
+++ b/llvm/test/CodeGen/X86/no-sse-x86.ll
@@ -4,8 +4,8 @@
 
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
 target triple = "i386-unknown-linux-gnu"
- at f = external global float
- at d = external global double
+ at f = external dso_local global float
+ at d = external dso_local global double
 
 define void @test() nounwind {
 ; CHECK-LABEL: test:

diff  --git a/llvm/test/CodeGen/X86/overlap-shift.ll b/llvm/test/CodeGen/X86/overlap-shift.ll
index 7f51baea4abe..06e7ca280d82 100644
--- a/llvm/test/CodeGen/X86/overlap-shift.ll
+++ b/llvm/test/CodeGen/X86/overlap-shift.ll
@@ -9,7 +9,7 @@
 
 ; Check that the shift gets turned into an LEA.
 
- at G = external global i32                ; <i32*> [#uses=1]
+ at G = external dso_local global i32                ; <i32*> [#uses=1]
 
 define i32 @test1(i32 %X) {
 ; CHECK-LABEL: test1:

diff  --git a/llvm/test/CodeGen/X86/packed_struct.ll b/llvm/test/CodeGen/X86/packed_struct.ll
index b0c4ea0e2640..a0281c3610ad 100644
--- a/llvm/test/CodeGen/X86/packed_struct.ll
+++ b/llvm/test/CodeGen/X86/packed_struct.ll
@@ -8,7 +8,7 @@
 target datalayout = "e-p:32:32"
 target triple = "i686-pc-linux-gnu"
 	%struct.anon = type <{ i8, i32, i32, i32 }>
- at foos = external global %struct.anon		; <%struct.anon*> [#uses=3]
+ at foos = external dso_local global %struct.anon		; <%struct.anon*> [#uses=3]
 @bara = weak global [4 x <{ i32, i8 }>] zeroinitializer		; <[4 x <{ i32, i8 }>]*> [#uses=2]
 
 define i32 @foo() nounwind {

diff  --git a/llvm/test/CodeGen/X86/peephole-na-phys-copy-folding.ll b/llvm/test/CodeGen/X86/peephole-na-phys-copy-folding.ll
index 63b761725bc4..d12043f2c2f7 100644
--- a/llvm/test/CodeGen/X86/peephole-na-phys-copy-folding.ll
+++ b/llvm/test/CodeGen/X86/peephole-na-phys-copy-folding.ll
@@ -6,8 +6,8 @@
 ; EFLAGS. Make sure the flags are used directly, instead of needlessly using
 ; saving and restoring specific conditions.
 
- at L = external global i32
- at M = external global i8
+ at L = external dso_local global i32
+ at M = external dso_local global i8
 
 declare i32 @bar(i64)
 

diff  --git a/llvm/test/CodeGen/X86/post-ra-sched.ll b/llvm/test/CodeGen/X86/post-ra-sched.ll
index f6de77a69883..cfa956613309 100644
--- a/llvm/test/CodeGen/X86/post-ra-sched.ll
+++ b/llvm/test/CodeGen/X86/post-ra-sched.ll
@@ -9,7 +9,7 @@
 ; happens during the post-RA-scheduler, which should be enabled by
 ; default with the above specified cpus.
 
- at ptrs = external global [0 x i32*], align 4
+ at ptrs = external dso_local global [0 x i32*], align 4
 @idxa = common global i32 0, align 4
 @idxb = common global i32 0, align 4
 @res = common global i32 0, align 4

diff  --git a/llvm/test/CodeGen/X86/pr15981.ll b/llvm/test/CodeGen/X86/pr15981.ll
index db66de55226c..58007de36bfd 100644
--- a/llvm/test/CodeGen/X86/pr15981.ll
+++ b/llvm/test/CodeGen/X86/pr15981.ll
@@ -2,9 +2,9 @@
 ; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefix=X86
 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=X64
 
- at a = external global i32
- at b = external global i32
- at c = external global i32
+ at a = external dso_local global i32
+ at b = external dso_local global i32
+ at c = external dso_local global i32
 
 define i32 @fn1(i32, i32) {
 ; X86-LABEL: fn1:

diff  --git a/llvm/test/CodeGen/X86/pr21792.ll b/llvm/test/CodeGen/X86/pr21792.ll
index 721aae9293bb..67d64c09566b 100644
--- a/llvm/test/CodeGen/X86/pr21792.ll
+++ b/llvm/test/CodeGen/X86/pr21792.ll
@@ -4,7 +4,7 @@
 ; This fixes a missing cases in the MI scheduler's constrainLocalCopy exposed by
 ; PR21792
 
- at stuff = external constant [256 x double], align 16
+ at stuff = external dso_local constant [256 x double], align 16
 
 define void @func(<4 x float> %vx) {
 ; CHECK-LABEL: func:

diff  --git a/llvm/test/CodeGen/X86/pr2585.ll b/llvm/test/CodeGen/X86/pr2585.ll
index 415164c87447..e8469255f23b 100644
--- a/llvm/test/CodeGen/X86/pr2585.ll
+++ b/llvm/test/CodeGen/X86/pr2585.ll
@@ -2,8 +2,8 @@
 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=X32
 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=X64
 
- at 0 = external constant <4 x i32>		; <<4 x i32>*>:0 [#uses=1]
- at 1 = external constant <4 x i16>		; <<4 x i16>*>:1 [#uses=1]
+ at 0 = external dso_local constant <4 x i32>		; <<4 x i32>*>:0 [#uses=1]
+ at 1 = external dso_local constant <4 x i16>		; <<4 x i16>*>:1 [#uses=1]
 
 define internal void @PR2585() {
 ; X32-LABEL: PR2585:

diff  --git a/llvm/test/CodeGen/X86/pr31045.ll b/llvm/test/CodeGen/X86/pr31045.ll
index 395c8275307d..eaddcb792da1 100644
--- a/llvm/test/CodeGen/X86/pr31045.ll
+++ b/llvm/test/CodeGen/X86/pr31045.ll
@@ -6,13 +6,13 @@
 %struct.a.0.4.8.12.36.68.72.88.92.96.104.120.360 = type <{ i8, i16 }>
 %struct.d.3.7.11.15.39.71.75.91.95.99.107.123.363 = type <{ %struct.c.2.6.10.14.38.70.74.90.94.98.106.122.362, %struct.c.2.6.10.14.38.70.74.90.94.98.106.122.362, i8, i8 }>
 
- at var_46 = external local_unnamed_addr global i8, align 1
- at var_44 = external local_unnamed_addr global i8, align 1
- at var_163 = external local_unnamed_addr global i8, align 1
- at struct_obj_12 = external local_unnamed_addr global %struct.c.2.6.10.14.38.70.74.90.94.98.106.122.362, align 2
- at struct_obj_3 = external local_unnamed_addr global %struct.d.3.7.11.15.39.71.75.91.95.99.107.123.363, align 2
- at struct_obj_8 = external local_unnamed_addr global %struct.d.3.7.11.15.39.71.75.91.95.99.107.123.363, align 2
- at var_49 = external local_unnamed_addr constant i8, align 1
+ at var_46 = external dso_local local_unnamed_addr global i8, align 1
+ at var_44 = external dso_local local_unnamed_addr global i8, align 1
+ at var_163 = external dso_local local_unnamed_addr global i8, align 1
+ at struct_obj_12 = external dso_local local_unnamed_addr global %struct.c.2.6.10.14.38.70.74.90.94.98.106.122.362, align 2
+ at struct_obj_3 = external dso_local local_unnamed_addr global %struct.d.3.7.11.15.39.71.75.91.95.99.107.123.363, align 2
+ at struct_obj_8 = external dso_local local_unnamed_addr global %struct.d.3.7.11.15.39.71.75.91.95.99.107.123.363, align 2
+ at var_49 = external dso_local local_unnamed_addr constant i8, align 1
 
 ; Function Attrs: norecurse nounwind uwtable
 define void @_Z1av() local_unnamed_addr #0 {

diff  --git a/llvm/test/CodeGen/X86/pr31271.ll b/llvm/test/CodeGen/X86/pr31271.ll
index cef6bd4e8e24..9b0e13bb442c 100644
--- a/llvm/test/CodeGen/X86/pr31271.ll
+++ b/llvm/test/CodeGen/X86/pr31271.ll
@@ -1,7 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc -mtriple=i386-unknown-linux-gnu < %s | FileCheck %s
 
- at c = external global [1 x i32], align 4
+ at c = external dso_local global [1 x i32], align 4
 
 define void @fn1(i32 %k, i32* %p) {
 ; CHECK-LABEL: fn1:

diff  --git a/llvm/test/CodeGen/X86/pr32256.ll b/llvm/test/CodeGen/X86/pr32256.ll
index e898295634a1..8cfc9e0f1ca3 100644
--- a/llvm/test/CodeGen/X86/pr32256.ll
+++ b/llvm/test/CodeGen/X86/pr32256.ll
@@ -1,7 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -fast-isel -mtriple=i686-unknown-unknown -O0 -mcpu=skx | FileCheck %s
 
- at c = external global i8, align 1
+ at c = external dso_local global i8, align 1
 
 ; Function Attrs: noinline nounwind
 define void @_Z1av() {

diff  --git a/llvm/test/CodeGen/X86/pr32284.ll b/llvm/test/CodeGen/X86/pr32284.ll
index cb9b33ca907b..ad3a3ffb19a8 100644
--- a/llvm/test/CodeGen/X86/pr32284.ll
+++ b/llvm/test/CodeGen/X86/pr32284.ll
@@ -4,7 +4,7 @@
 ; RUN: llc -fast-isel-sink-local-values -O0 -mtriple=i686-unknown   -mcpu=skx -o - %s | FileCheck %s --check-prefix=686-O0
 ; RUN: llc -fast-isel-sink-local-values     -mtriple=i686-unknown   -mcpu=skx -o - %s | FileCheck %s --check-prefix=686
 
- at c = external constant i8, align 1
+ at c = external dso_local constant i8, align 1
 
 define void @foo() {
 ; X86-O0-LABEL: foo:
@@ -115,9 +115,9 @@ entry:
   ret void
 }
 
- at var_5 = external global i32, align 4
- at var_57 = external global i64, align 8
- at _ZN8struct_210member_2_0E = external global i64, align 8
+ at var_5 = external dso_local global i32, align 4
+ at var_57 = external dso_local global i64, align 8
+ at _ZN8struct_210member_2_0E = external dso_local global i64, align 8
 
 define void @f1() {
 ; X86-O0-LABEL: f1:
@@ -280,7 +280,7 @@ entry:
 }
 
 
- at var_7 = external global i8, align 1
+ at var_7 = external dso_local global i8, align 1
 
 define void @f2() {
 ; X86-O0-LABEL: f2:
@@ -406,9 +406,9 @@ entry:
 }
 
 
- at var_13 = external global i32, align 4
- at var_16 = external global i32, align 4
- at var_46 = external global i32, align 4
+ at var_13 = external dso_local global i32, align 4
+ at var_16 = external dso_local global i32, align 4
+ at var_46 = external dso_local global i32, align 4
 
 define void @f3() #0 {
 ; X86-O0-LABEL: f3:

diff  --git a/llvm/test/CodeGen/X86/pr32329.ll b/llvm/test/CodeGen/X86/pr32329.ll
index 8323bd1a242e..33e2ec16a18e 100644
--- a/llvm/test/CodeGen/X86/pr32329.ll
+++ b/llvm/test/CodeGen/X86/pr32329.ll
@@ -5,14 +5,14 @@
 
 %struct.AA = type { i24, [4 x i8] }
 
- at obj = external local_unnamed_addr global %struct.AA, align 8
- at var_27 = external local_unnamed_addr constant i8, align 1
- at var_2 = external local_unnamed_addr constant i16, align 2
- at var_24 = external local_unnamed_addr constant i64, align 8
- at var_310 = external local_unnamed_addr global i64, align 8
- at var_50 = external local_unnamed_addr global i64, align 8
- at var_205 = external local_unnamed_addr global i8, align 1
- at var_218 = external local_unnamed_addr global i8, align 1
+ at obj = external dso_local local_unnamed_addr global %struct.AA, align 8
+ at var_27 = external dso_local local_unnamed_addr constant i8, align 1
+ at var_2 = external dso_local local_unnamed_addr constant i16, align 2
+ at var_24 = external dso_local local_unnamed_addr constant i64, align 8
+ at var_310 = external dso_local local_unnamed_addr global i64, align 8
+ at var_50 = external dso_local local_unnamed_addr global i64, align 8
+ at var_205 = external dso_local local_unnamed_addr global i8, align 1
+ at var_218 = external dso_local local_unnamed_addr global i8, align 1
 
 define void @foo() local_unnamed_addr {
 ; X86-LABEL: foo:

diff  --git a/llvm/test/CodeGen/X86/pr32340.ll b/llvm/test/CodeGen/X86/pr32340.ll
index 15774d605e62..ab48ad2d8e2e 100644
--- a/llvm/test/CodeGen/X86/pr32340.ll
+++ b/llvm/test/CodeGen/X86/pr32340.ll
@@ -1,14 +1,14 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc -fast-isel-sink-local-values -O0 -mtriple=x86_64-unknown-linux-gnu -fast-isel-abort=1 -o - %s | FileCheck %s -check-prefix=X64
 
- at var_825 = external global i16, align 2
- at var_32 = external global i16, align 2
- at var_901 = external global i16, align 2
- at var_826 = external global i64, align 8
- at var_57 = external global i64, align 8
- at var_900 = external global i16, align 2
- at var_28 = external constant i64, align 8
- at var_827 = external global i16, align 2
+ at var_825 = external dso_local global i16, align 2
+ at var_32 = external dso_local global i16, align 2
+ at var_901 = external dso_local global i16, align 2
+ at var_826 = external dso_local global i64, align 8
+ at var_57 = external dso_local global i64, align 8
+ at var_900 = external dso_local global i16, align 2
+ at var_28 = external dso_local constant i64, align 8
+ at var_827 = external dso_local global i16, align 2
 
 define void @foo() {
 ; X64-LABEL: foo:

diff  --git a/llvm/test/CodeGen/X86/pr32345.ll b/llvm/test/CodeGen/X86/pr32345.ll
index 2182e8b4f901..2ac36b213dd2 100644
--- a/llvm/test/CodeGen/X86/pr32345.ll
+++ b/llvm/test/CodeGen/X86/pr32345.ll
@@ -4,8 +4,8 @@
 ; RUN: llc -fast-isel-sink-local-values     -mtriple=x86_64-unknown-linux-gnu -o - %s | FileCheck %s -check-prefix=X64
 ; RUN: llc -fast-isel-sink-local-values     -mtriple=i686-unknown             -o - %s | FileCheck %s -check-prefix=686
 
- at var_22 = external global i16, align 2
- at var_27 = external global i16, align 2
+ at var_22 = external dso_local global i16, align 2
+ at var_27 = external dso_local global i16, align 2
 
 define void @foo() {
 ; X640-LABEL: foo:

diff  --git a/llvm/test/CodeGen/X86/pr3241.ll b/llvm/test/CodeGen/X86/pr3241.ll
index a324cf2ffa94..112977807765 100644
--- a/llvm/test/CodeGen/X86/pr3241.ll
+++ b/llvm/test/CodeGen/X86/pr3241.ll
@@ -1,7 +1,7 @@
 ; RUN: llc < %s -mtriple=i686--
 ; PR3241
 
- at g_620 = external global i32
+ at g_620 = external dso_local global i32
 
 define void @func_18(i32 %p_21) nounwind {
 entry:

diff  --git a/llvm/test/CodeGen/X86/pr3244.ll b/llvm/test/CodeGen/X86/pr3244.ll
index 166ca90d7995..957c24573e5a 100644
--- a/llvm/test/CodeGen/X86/pr3244.ll
+++ b/llvm/test/CodeGen/X86/pr3244.ll
@@ -1,8 +1,8 @@
 ; RUN: llc < %s -mtriple=i686--
 ; PR3244
 
- at g_62 = external global i16             ; <i16*> [#uses=1]
- at g_487 = external global i32            ; <i32*> [#uses=1]
+ at g_62 = external dso_local global i16             ; <i16*> [#uses=1]
+ at g_487 = external dso_local global i32            ; <i32*> [#uses=1]
 
 define i32 @func_42(i32 %p_43, i32 %p_44, i32 %p_45, i32 %p_46) nounwind {
 entry:

diff  --git a/llvm/test/CodeGen/X86/pr32515.ll b/llvm/test/CodeGen/X86/pr32515.ll
index aeb6803867aa..b5a7c64bd773 100644
--- a/llvm/test/CodeGen/X86/pr32515.ll
+++ b/llvm/test/CodeGen/X86/pr32515.ll
@@ -4,7 +4,7 @@
 ; RUN: llc     -mtriple=i686-unknown   -mcpu=skx -o - %s
 ; REQUIRES: asserts
 
- at var_26 = external global i16, align 2
+ at var_26 = external dso_local global i16, align 2
 
 define void @foo() #0 {
  %1 = alloca i16, align 2

diff  --git a/llvm/test/CodeGen/X86/pr32588.ll b/llvm/test/CodeGen/X86/pr32588.ll
index e6222f6a3a8f..223fd5dc3b88 100644
--- a/llvm/test/CodeGen/X86/pr32588.ll
+++ b/llvm/test/CodeGen/X86/pr32588.ll
@@ -1,9 +1,9 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux | FileCheck %s
 
- at c = external local_unnamed_addr global i32, align 4
- at b = external local_unnamed_addr global i32, align 4
- at d = external local_unnamed_addr global i32, align 4
+ at c = external dso_local local_unnamed_addr global i32, align 4
+ at b = external dso_local local_unnamed_addr global i32, align 4
+ at d = external dso_local local_unnamed_addr global i32, align 4
 
 define void @fn1() {
 ; CHECK-LABEL: fn1:

diff  --git a/llvm/test/CodeGen/X86/pr32659.ll b/llvm/test/CodeGen/X86/pr32659.ll
index ad3a78052b66..e60929b1afed 100644
--- a/llvm/test/CodeGen/X86/pr32659.ll
+++ b/llvm/test/CodeGen/X86/pr32659.ll
@@ -3,17 +3,17 @@
 
 target triple = "i386-unknown-linux-gnu"
 
- at a = external global i32, align 4
- at d = external global i32*, align 4
- at k = external global i32**, align 4
- at j = external global i32***, align 4
- at h = external global i32, align 4
- at c = external global i32, align 4
- at i = external global i32, align 4
- at b = external global i32, align 4
- at f = external global i64, align 8
- at e = external global i64, align 8
- at g = external global i32, align 4
+ at a = external dso_local global i32, align 4
+ at d = external dso_local global i32*, align 4
+ at k = external dso_local global i32**, align 4
+ at j = external dso_local global i32***, align 4
+ at h = external dso_local global i32, align 4
+ at c = external dso_local global i32, align 4
+ at i = external dso_local global i32, align 4
+ at b = external dso_local global i32, align 4
+ at f = external dso_local global i64, align 8
+ at e = external dso_local global i64, align 8
+ at g = external dso_local global i32, align 4
 
 declare i32 @fn1(i32 returned) optsize readnone
 

diff  --git a/llvm/test/CodeGen/X86/pr33828.ll b/llvm/test/CodeGen/X86/pr33828.ll
index 1c2489a8863c..56737206246c 100644
--- a/llvm/test/CodeGen/X86/pr33828.ll
+++ b/llvm/test/CodeGen/X86/pr33828.ll
@@ -2,7 +2,7 @@
 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mcpu=haswell | FileCheck %s --check-prefix=X86
 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=haswell | FileCheck %s --check-prefix=X64
 
- at var_580 = external local_unnamed_addr global i8, align 1
+ at var_580 = external dso_local local_unnamed_addr global i8, align 1
 
 define void @foo(i8 %a0) {
 ; X86-LABEL: foo:

diff  --git a/llvm/test/CodeGen/X86/pr33960.ll b/llvm/test/CodeGen/X86/pr33960.ll
index fd5a9a400503..582d2e902698 100644
--- a/llvm/test/CodeGen/X86/pr33960.ll
+++ b/llvm/test/CodeGen/X86/pr33960.ll
@@ -2,7 +2,7 @@
 ; RUN: llc < %s -mtriple=i686-unknown -mattr=+avx | FileCheck %s --check-prefix=X86
 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx | FileCheck %s --check-prefix=X64
 
- at b = external local_unnamed_addr global i32, align 4
+ at b = external dso_local local_unnamed_addr global i32, align 4
 
 define void @PR33960() {
 ; X86-LABEL: PR33960:

diff  --git a/llvm/test/CodeGen/X86/pr34137.ll b/llvm/test/CodeGen/X86/pr34137.ll
index 1a85a667b3d8..f24b96fc5e00 100644
--- a/llvm/test/CodeGen/X86/pr34137.ll
+++ b/llvm/test/CodeGen/X86/pr34137.ll
@@ -1,9 +1,9 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
 
- at var_3 = external global i16, align 2
- at var_13 = external global i16, align 2
- at var_212 = external global i64, align 8
+ at var_3 = external dso_local global i16, align 2
+ at var_13 = external dso_local global i16, align 2
+ at var_212 = external dso_local global i64, align 8
 
 define void @pr34127() {
 ; CHECK-LABEL: pr34127:

diff  --git a/llvm/test/CodeGen/X86/pr34292.ll b/llvm/test/CodeGen/X86/pr34292.ll
index 4e1a3a340190..01f7d553b864 100644
--- a/llvm/test/CodeGen/X86/pr34292.ll
+++ b/llvm/test/CodeGen/X86/pr34292.ll
@@ -3,7 +3,7 @@
 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+adx | FileCheck %s
 
 ; PR34292
- at _ZL1c = external global i8
+ at _ZL1c = external dso_local global i8
 define void @sum_unroll(i64* nocapture readonly, i64* nocapture) {
 ; CHECK-LABEL: sum_unroll:
 ; CHECK:       # %bb.0:

diff  --git a/llvm/test/CodeGen/X86/pr34381.ll b/llvm/test/CodeGen/X86/pr34381.ll
index 831b1d23402d..fd91f75d6b31 100644
--- a/llvm/test/CodeGen/X86/pr34381.ll
+++ b/llvm/test/CodeGen/X86/pr34381.ll
@@ -1,11 +1,11 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ;RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=slow-incdec | FileCheck %s
 
- at var_21 = external constant i32, align 4
- at var_29 = external constant i8, align 1
- at var_390 = external global i32, align 4
- at var_11 = external constant i8, align 1
- at var_370 = external global i8, align 1
+ at var_21 = external dso_local constant i32, align 4
+ at var_29 = external dso_local constant i8, align 1
+ at var_390 = external dso_local global i32, align 4
+ at var_11 = external dso_local constant i8, align 1
+ at var_370 = external dso_local global i8, align 1
 
 ; Function Attrs: noinline nounwind optnone uwtable
 define void @_Z3foov() {

diff  --git a/llvm/test/CodeGen/X86/pr3522.ll b/llvm/test/CodeGen/X86/pr3522.ll
index d7a332b1fed7..f518d0e1624a 100644
--- a/llvm/test/CodeGen/X86/pr3522.ll
+++ b/llvm/test/CodeGen/X86/pr3522.ll
@@ -3,7 +3,7 @@
 ; PR3522
 
 target triple = "i386-pc-linux-gnu"
- at .str = external constant [13 x i8]		; <[13 x i8]*> [#uses=1]
+ at .str = external dso_local constant [13 x i8]		; <[13 x i8]*> [#uses=1]
 
 define void @_ada_c34018a() personality i32 (...)* @__gxx_personality_v0 {
 entry:

diff  --git a/llvm/test/CodeGen/X86/pr35316.ll b/llvm/test/CodeGen/X86/pr35316.ll
index 45c771f6fffa..2cb9733fbf8c 100644
--- a/llvm/test/CodeGen/X86/pr35316.ll
+++ b/llvm/test/CodeGen/X86/pr35316.ll
@@ -3,9 +3,9 @@
 
 ; This tests for a cyclic dependencies in the generated DAG. 
 
- at c = external local_unnamed_addr global i32, align 4
- at a = external local_unnamed_addr global i32, align 4
- at b = external local_unnamed_addr global i32, align 4
+ at c = external dso_local local_unnamed_addr global i32, align 4
+ at a = external dso_local local_unnamed_addr global i32, align 4
+ at b = external dso_local local_unnamed_addr global i32, align 4
 
 define void @foo() {
 ; CHECK-LABEL: foo:

diff  --git a/llvm/test/CodeGen/X86/pr35443.ll b/llvm/test/CodeGen/X86/pr35443.ll
index 01001b021bec..d8d6e5113a1b 100644
--- a/llvm/test/CodeGen/X86/pr35443.ll
+++ b/llvm/test/CodeGen/X86/pr35443.ll
@@ -1,8 +1,8 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown -mcpu=skx | FileCheck %s
 
- at ac = external local_unnamed_addr global [20 x i8], align 1
- at ai3 = external local_unnamed_addr global [20 x i32], align 16
+ at ac = external dso_local local_unnamed_addr global [20 x i8], align 1
+ at ai3 = external dso_local local_unnamed_addr global [20 x i32], align 16
 
 ; Function Attrs: norecurse nounwind uwtable
 define void @pr35443() {

diff  --git a/llvm/test/CodeGen/X86/pr36274.ll b/llvm/test/CodeGen/X86/pr36274.ll
index 97b958c6b683..dba32313e41b 100644
--- a/llvm/test/CodeGen/X86/pr36274.ll
+++ b/llvm/test/CodeGen/X86/pr36274.ll
@@ -6,7 +6,7 @@
 ; to the load causing a cycle. Here the dependence in question comes
 ; from the carry in input of the adcl.
 
- at vx = external local_unnamed_addr global <2 x i32>, align 8
+ at vx = external dso_local local_unnamed_addr global <2 x i32>, align 8
 
 define void @pr36274(i32* %somewhere) {
 ; CHECK-LABEL: pr36274:

diff  --git a/llvm/test/CodeGen/X86/pr37916.ll b/llvm/test/CodeGen/X86/pr37916.ll
index 484104da9ff4..84b8c08f9ea4 100644
--- a/llvm/test/CodeGen/X86/pr37916.ll
+++ b/llvm/test/CodeGen/X86/pr37916.ll
@@ -1,8 +1,8 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc -mtriple=i386-unknown-linux-gnu %s -o - | FileCheck %s
 
- at f = external local_unnamed_addr global i64*, align 4
- at a = external global i64, align 8
+ at f = external dso_local local_unnamed_addr global i64*, align 4
+ at a = external dso_local global i64, align 8
 
 define void @fn1() local_unnamed_addr {
 ; CHECK-LABEL: fn1:

diff  --git a/llvm/test/CodeGen/X86/pr40539.ll b/llvm/test/CodeGen/X86/pr40539.ll
index f2135cd2e73b..a727e83cdca7 100644
--- a/llvm/test/CodeGen/X86/pr40539.ll
+++ b/llvm/test/CodeGen/X86/pr40539.ll
@@ -32,7 +32,7 @@ entry:
   ret i1 %3
 }
 
- at fpi = external global float, align 4
+ at fpi = external dso_local global float, align 4
 
 define zeroext i1 @_Z8test_cosv() {
 ; CHECK-LABEL: _Z8test_cosv:

diff  --git a/llvm/test/CodeGen/X86/pr42452.ll b/llvm/test/CodeGen/X86/pr42452.ll
index 14a6f3d13300..cb141ad8d7e2 100644
--- a/llvm/test/CodeGen/X86/pr42452.ll
+++ b/llvm/test/CodeGen/X86/pr42452.ll
@@ -1,7 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -O0 | FileCheck %s
 
- at b = external global i64, align 8
+ at b = external dso_local global i64, align 8
 
 define void @foo(i1 %c, <2 x i64> %x) {
 ; CHECK-LABEL: foo:

diff  --git a/llvm/test/CodeGen/X86/pr47482.ll b/llvm/test/CodeGen/X86/pr47482.ll
index e0f01f3c5115..d78b1aea0e46 100644
--- a/llvm/test/CodeGen/X86/pr47482.ll
+++ b/llvm/test/CodeGen/X86/pr47482.ll
@@ -1,8 +1,8 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=bmi | FileCheck %s
 
- at a = external local_unnamed_addr global i32, align 4
- at f = external local_unnamed_addr global i32, align 4
+ at a = external dso_local local_unnamed_addr global i32, align 4
+ at f = external dso_local local_unnamed_addr global i32, align 4
 
 define void @g(i32* %x, i32* %y, i32* %z) {
 ; CHECK-LABEL: g:

diff  --git a/llvm/test/CodeGen/X86/pr5145.ll b/llvm/test/CodeGen/X86/pr5145.ll
index 582d3276e358..e3658d87e895 100644
--- a/llvm/test/CodeGen/X86/pr5145.ll
+++ b/llvm/test/CodeGen/X86/pr5145.ll
@@ -1,6 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc -mtriple=x86_64-- < %s | FileCheck %s
- at sc8 = external global i8
+ at sc8 = external dso_local global i8
 
 define void @atomic_maxmin_i8() {
 ; CHECK-LABEL: atomic_maxmin_i8:

diff  --git a/llvm/test/CodeGen/X86/rd-mod-wr-eflags.ll b/llvm/test/CodeGen/X86/rd-mod-wr-eflags.ll
index a2fc94d70fda..16dcea56a0d4 100644
--- a/llvm/test/CodeGen/X86/rd-mod-wr-eflags.ll
+++ b/llvm/test/CodeGen/X86/rd-mod-wr-eflags.ll
@@ -226,7 +226,7 @@ return:
 
 ; Deal with TokenFactor chain
 ; rdar://11236106
- at foo = external global i64*, align 8
+ at foo = external dso_local global i64*, align 8
 
 define void @test3() nounwind ssp {
 ; CHECK-LABEL: test3:
@@ -261,9 +261,9 @@ declare void @baz()
 ; scheduler.
 ; PR12565
 ; rdar://11451474
- at x = external global i32, align 4
- at y = external global i32, align 4
- at z = external global i32, align 4
+ at x = external dso_local global i32, align 4
+ at y = external dso_local global i32, align 4
+ at z = external dso_local global i32, align 4
 
 define void @test4() nounwind uwtable ssp {
 ; CHECK-LABEL: test4:

diff  --git a/llvm/test/CodeGen/X86/remat-constant.ll b/llvm/test/CodeGen/X86/remat-constant.ll
index 332d635f87c3..ca56ac79268e 100644
--- a/llvm/test/CodeGen/X86/remat-constant.ll
+++ b/llvm/test/CodeGen/X86/remat-constant.ll
@@ -3,7 +3,7 @@
 
 declare void @bar() nounwind
 
- at a = external constant float
+ at a = external dso_local constant float
 
 declare void @qux(float %f) nounwind
 

diff  --git a/llvm/test/CodeGen/X86/retpoline-external.ll b/llvm/test/CodeGen/X86/retpoline-external.ll
index 849660cdedbd..c7f297462529 100644
--- a/llvm/test/CodeGen/X86/retpoline-external.ll
+++ b/llvm/test/CodeGen/X86/retpoline-external.ll
@@ -58,7 +58,7 @@ entry:
 ; X86FAST:       calll __x86_indirect_thunk_eax
 
 
- at global_fp = external global void (i32)*
+ at global_fp = external dso_local global void (i32)*
 
 ; Test an indirect call through a global variable.
 define void @icall_global_fp(i32 %x, void (i32)** %fpp) #0 {

diff  --git a/llvm/test/CodeGen/X86/retpoline.ll b/llvm/test/CodeGen/X86/retpoline.ll
index 9a1673e8a567..155c1540ea88 100644
--- a/llvm/test/CodeGen/X86/retpoline.ll
+++ b/llvm/test/CodeGen/X86/retpoline.ll
@@ -58,7 +58,7 @@ entry:
 ; X86FAST:       calll __llvm_retpoline_eax
 
 
- at global_fp = external global void (i32)*
+ at global_fp = external dso_local global void (i32)*
 
 ; Test an indirect call through a global variable.
 define void @icall_global_fp(i32 %x, void (i32)** %fpp) #0 {

diff  --git a/llvm/test/CodeGen/X86/shift-one.ll b/llvm/test/CodeGen/X86/shift-one.ll
index c4c50afb2634..973b022caa78 100644
--- a/llvm/test/CodeGen/X86/shift-one.ll
+++ b/llvm/test/CodeGen/X86/shift-one.ll
@@ -1,7 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc < %s -mtriple=i686-- | FileCheck %s
 
- at x = external global i32                ; <i32*> [#uses=1]
+ at x = external dso_local global i32                ; <i32*> [#uses=1]
 
 define i32 @test() {
 ; CHECK-LABEL: test:

diff  --git a/llvm/test/CodeGen/X86/shift-parts.ll b/llvm/test/CodeGen/X86/shift-parts.ll
index da00f377020d..e33faed8a3ed 100644
--- a/llvm/test/CodeGen/X86/shift-parts.ll
+++ b/llvm/test/CodeGen/X86/shift-parts.ll
@@ -4,7 +4,7 @@
 
 %0 = type { i32, i8, [35 x i8] }
 
- at g_144 = external global %0, align 8              ; <%0*> [#uses=1]
+ at g_144 = external dso_local global %0, align 8              ; <%0*> [#uses=1]
 
 define i32 @int87(i32 %uint64p_8, i1 %cond) nounwind {
 ; CHECK-LABEL: int87:

diff  --git a/llvm/test/CodeGen/X86/shl-crash-on-legalize.ll b/llvm/test/CodeGen/X86/shl-crash-on-legalize.ll
index 4c3c999e1cba..08f89d26302a 100644
--- a/llvm/test/CodeGen/X86/shl-crash-on-legalize.ll
+++ b/llvm/test/CodeGen/X86/shl-crash-on-legalize.ll
@@ -6,7 +6,7 @@
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
- at structMember = external local_unnamed_addr global i64, align 8
+ at structMember = external dso_local local_unnamed_addr global i64, align 8
 
 define i32 @PR29058(i8 %x, i32 %y) {
 ; CHECK-LABEL: PR29058:

diff  --git a/llvm/test/CodeGen/X86/shrink_vmul.ll b/llvm/test/CodeGen/X86/shrink_vmul.ll
index 3f9c77acf50a..e09b4ce81e7c 100644
--- a/llvm/test/CodeGen/X86/shrink_vmul.ll
+++ b/llvm/test/CodeGen/X86/shrink_vmul.ll
@@ -6,7 +6,7 @@
 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx  | FileCheck %s --check-prefixes=X64-AVX,X64-AVX1
 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=X64-AVX,X64-AVX2
 
- at c = external global i32*, align 8
+ at c = external dso_local global i32*, align 8
 
 ; %val1 = load <2 x i8>
 ; %op1 = zext<2 x i32> %val1

diff  --git a/llvm/test/CodeGen/X86/shrink_vmul_sse.ll b/llvm/test/CodeGen/X86/shrink_vmul_sse.ll
index 93bb2a4b1cdb..a420069adb11 100644
--- a/llvm/test/CodeGen/X86/shrink_vmul_sse.ll
+++ b/llvm/test/CodeGen/X86/shrink_vmul_sse.ll
@@ -5,7 +5,7 @@
 ;
 ; RUN: llc -mtriple=i386-pc-linux-gnu -mattr=+sse < %s | FileCheck %s
 
- at c = external global i32*, align 8
+ at c = external dso_local global i32*, align 8
 
 define void @mul_2xi8(i8* nocapture readonly %a, i8* nocapture readonly %b, i64 %index) nounwind {
 ; CHECK-LABEL: mul_2xi8:

diff  --git a/llvm/test/CodeGen/X86/sink-hoist.ll b/llvm/test/CodeGen/X86/sink-hoist.ll
index 8111aa72b6e7..fe1c25d66af7 100644
--- a/llvm/test/CodeGen/X86/sink-hoist.ll
+++ b/llvm/test/CodeGen/X86/sink-hoist.ll
@@ -153,7 +153,7 @@ declare <4 x float> @llvm.x86.sse2.cvtdq2ps(<4 x i32>) nounwind readnone
 ; CHECK-LABEL: default_get_pch_validity:
 ; CHECK: movl cl_options_count(%rip), %ecx
 
- at cl_options_count = external constant i32         ; <i32*> [#uses=2]
+ at cl_options_count = external dso_local constant i32         ; <i32*> [#uses=2]
 
 define void @default_get_pch_validity() nounwind {
 entry:

diff  --git a/llvm/test/CodeGen/X86/sink-local-value.ll b/llvm/test/CodeGen/X86/sink-local-value.ll
index f7d861ac9b6c..677f4feb00e0 100644
--- a/llvm/test/CodeGen/X86/sink-local-value.ll
+++ b/llvm/test/CodeGen/X86/sink-local-value.ll
@@ -5,7 +5,7 @@ target triple = "i386-linux-gnu"
 
 ; Try some simple cases that show how local value sinking improves line tables.
 
- at sink_across = external global i32
+ at sink_across = external dso_local global i32
 
 declare void @simple_callee(i32, i32)
 

diff  --git a/llvm/test/CodeGen/X86/sse2.ll b/llvm/test/CodeGen/X86/sse2.ll
index ec1ed4688c85..3dab8f9ce3f9 100644
--- a/llvm/test/CodeGen/X86/sse2.ll
+++ b/llvm/test/CodeGen/X86/sse2.ll
@@ -269,7 +269,7 @@ define void @test7() nounwind {
   ret void
 }
 
- at x = external global [4 x i32]
+ at x = external dso_local global [4 x i32]
 
 define <2 x i64> @test8() nounwind {
 ; X86-SSE-LABEL: test8:

diff  --git a/llvm/test/CodeGen/X86/sse3.ll b/llvm/test/CodeGen/X86/sse3.ll
index a1951442efad..750abbabb545 100644
--- a/llvm/test/CodeGen/X86/sse3.ll
+++ b/llvm/test/CodeGen/X86/sse3.ll
@@ -249,8 +249,8 @@ define void @t9(<4 x float>* %r, <2 x i32>* %A) nounwind {
 ; FIXME: This testcase produces icky code. It can be made much better!
 ; PR2585
 
- at g1 = external constant <4 x i32>
- at g2 = external constant <4 x i16>
+ at g1 = external dso_local constant <4 x i32>
+ at g2 = external dso_local constant <4 x i16>
 
 define void @t10() nounwind {
 ; X86-LABEL: t10:

diff  --git a/llvm/test/CodeGen/X86/store-fp-constant.ll b/llvm/test/CodeGen/X86/store-fp-constant.ll
index caf3c28c3275..8e0de0dbbaa3 100644
--- a/llvm/test/CodeGen/X86/store-fp-constant.ll
+++ b/llvm/test/CodeGen/X86/store-fp-constant.ll
@@ -7,7 +7,7 @@
 ; Check that no FP constants in this testcase ends up in the 
 ; constant pool.
 
- at G = external global float              ; <float*> [#uses=1]
+ at G = external dso_local global float              ; <float*> [#uses=1]
 
 declare void @extfloat(float)
 

diff  --git a/llvm/test/CodeGen/X86/stride-nine-with-base-reg.ll b/llvm/test/CodeGen/X86/stride-nine-with-base-reg.ll
index 7c8f362a2cfc..de134046306d 100644
--- a/llvm/test/CodeGen/X86/stride-nine-with-base-reg.ll
+++ b/llvm/test/CodeGen/X86/stride-nine-with-base-reg.ll
@@ -5,10 +5,10 @@
 ; P should be sunk into the loop and folded into the address mode. There
 ; shouldn't be any lea instructions inside the loop.
 
- at B = external global [1000 x i8], align 32
- at A = external global [1000 x i8], align 32
- at P = external global [1000 x i8], align 32
- at Q = external global [1000 x i8], align 32
+ at B = external dso_local global [1000 x i8], align 32
+ at A = external dso_local global [1000 x i8], align 32
+ at P = external dso_local global [1000 x i8], align 32
+ at Q = external dso_local global [1000 x i8], align 32
 
 define void @foo(i32 %m, i32 %p) nounwind {
 entry:

diff  --git a/llvm/test/CodeGen/X86/stride-reuse.ll b/llvm/test/CodeGen/X86/stride-reuse.ll
index 986207428cc7..6674306b6bbb 100644
--- a/llvm/test/CodeGen/X86/stride-reuse.ll
+++ b/llvm/test/CodeGen/X86/stride-reuse.ll
@@ -2,9 +2,9 @@
 ; RUN: llc < %s -mcpu=generic -mtriple=x86_64-linux | FileCheck %s
 ; CHECK-NOT:     lea
 
- at B = external global [1000 x float], align 32
- at A = external global [1000 x float], align 32
- at P = external global [1000 x i32], align 32
+ at B = external dso_local global [1000 x float], align 32
+ at A = external dso_local global [1000 x float], align 32
+ at P = external dso_local global [1000 x i32], align 32
 
 define void @foo(i32 %m) nounwind {
 entry:

diff  --git a/llvm/test/CodeGen/X86/tail-merge-identical.ll b/llvm/test/CodeGen/X86/tail-merge-identical.ll
index 024ad582d03f..b29d1c000127 100644
--- a/llvm/test/CodeGen/X86/tail-merge-identical.ll
+++ b/llvm/test/CodeGen/X86/tail-merge-identical.ll
@@ -2,8 +2,8 @@
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
- at data = external global [3 x i32], align 4
- at store = external global i32, align 4
+ at data = external dso_local global [3 x i32], align 4
+ at store = external dso_local global i32, align 4
 
 ; %else1 and %then2 end up lowering to identical blocks. These blocks should be
 ; merged during tail-merging.

diff  --git a/llvm/test/CodeGen/X86/tail-opts.ll b/llvm/test/CodeGen/X86/tail-opts.ll
index 89c26df49b87..e70ecf09f087 100644
--- a/llvm/test/CodeGen/X86/tail-opts.ll
+++ b/llvm/test/CodeGen/X86/tail-opts.ll
@@ -428,7 +428,7 @@ declare void @func()
 
 ; one - One instruction may be tail-duplicated even with optsize.
 
- at XYZ = external global i32
+ at XYZ = external dso_local global i32
 
 declare void @tail_call_me()
 

diff  --git a/llvm/test/CodeGen/X86/v4i32load-crash.ll b/llvm/test/CodeGen/X86/v4i32load-crash.ll
index 359e89e11e1f..1cf0a99cf3c5 100644
--- a/llvm/test/CodeGen/X86/v4i32load-crash.ll
+++ b/llvm/test/CodeGen/X86/v4i32load-crash.ll
@@ -7,8 +7,8 @@
 ;This node was generated by X86ISelLowering.cpp, EltsFromConsecutiveLoads
 ;static function after legalize stage.
 
- at e = external global [4 x i32], align 4
- at f = external global [4 x i32], align 4
+ at e = external dso_local global [4 x i32], align 4
+ at f = external dso_local global [4 x i32], align 4
 
 ; Function Attrs: nounwind
 define void @fn3(i32 %el) {

diff  --git a/llvm/test/CodeGen/X86/vec_zero_cse.ll b/llvm/test/CodeGen/X86/vec_zero_cse.ll
index 8629b2141b19..7f20ddec3bfc 100644
--- a/llvm/test/CodeGen/X86/vec_zero_cse.ll
+++ b/llvm/test/CodeGen/X86/vec_zero_cse.ll
@@ -4,11 +4,11 @@
 
 ; 64-bit stores here do not use MMX.
 
- at M1 = external global <1 x i64>
- at M2 = external global <2 x i32>
+ at M1 = external dso_local global <1 x i64>
+ at M2 = external dso_local global <2 x i32>
 
- at S1 = external global <2 x i64>
- at S2 = external global <4 x i32>
+ at S1 = external dso_local global <2 x i64>
+ at S2 = external dso_local global <4 x i32>
 
 define void @test1() {
 ; X32-LABEL: test1:

diff  --git a/llvm/test/CodeGen/X86/volatile.ll b/llvm/test/CodeGen/X86/volatile.ll
index 8e293e44e86d..089f72a31c62 100644
--- a/llvm/test/CodeGen/X86/volatile.ll
+++ b/llvm/test/CodeGen/X86/volatile.ll
@@ -2,7 +2,7 @@
 ; RUN: llc < %s -mtriple=i686-- -mattr=sse2 | FileCheck %s
 ; RUN: llc < %s -mtriple=i686-- -mattr=sse2 -O0 | FileCheck %s
 
- at x = external global double
+ at x = external dso_local global double
 
 define void @foo() nounwind  {
 ; CHECK-LABEL: foo:

diff  --git a/llvm/test/CodeGen/X86/x32-function_pointer-1.ll b/llvm/test/CodeGen/X86/x32-function_pointer-1.ll
index 952add91d52b..c44d7a80bc2a 100644
--- a/llvm/test/CodeGen/X86/x32-function_pointer-1.ll
+++ b/llvm/test/CodeGen/X86/x32-function_pointer-1.ll
@@ -3,8 +3,8 @@
 
 ; Test for x32 function pointer tail call
 
- at foo1 = external global void (i8*)*
- at foo2 = external global void (i8*)*
+ at foo1 = external dso_local global void (i8*)*
+ at foo2 = external dso_local global void (i8*)*
 
 define void @bar(i8* %h) nounwind uwtable {
 entry:

diff  --git a/llvm/test/CodeGen/X86/x86-64-disp.ll b/llvm/test/CodeGen/X86/x86-64-disp.ll
index 78168025e747..64822008fd1b 100644
--- a/llvm/test/CodeGen/X86/x86-64-disp.ll
+++ b/llvm/test/CodeGen/X86/x86-64-disp.ll
@@ -6,7 +6,7 @@
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
 target triple = "x86_64-unknown-linux-gnu"
- at call_used_regs = external global [53 x i8], align 32
+ at call_used_regs = external dso_local global [53 x i8], align 32
 
 define fastcc void @foo() nounwind {
 ; CHECK-LABEL: foo:

diff  --git a/llvm/test/CodeGen/XCore/codemodel.ll b/llvm/test/CodeGen/XCore/codemodel.ll
index fdc0d086c679..cf22385e7cb0 100644
--- a/llvm/test/CodeGen/XCore/codemodel.ll
+++ b/llvm/test/CodeGen/XCore/codemodel.ll
@@ -28,8 +28,8 @@
 ; LARGE: [[JUMP]]
 ; LARGE: ldw r0, r11[0]
 ; LARGE: retsp 0
- at A1 = external global [50000 x i32]
- at A2 = external global [50000 x i32]
+ at A1 = external dso_local global [50000 x i32]
+ at A2 = external dso_local global [50000 x i32]
 define [50000 x i32]* @test(i1 %bool) nounwind {
 entry:
   %Addr = select i1 %bool, [50000 x i32]* @A1, [50000 x i32]* @A2
@@ -130,7 +130,7 @@ entry:
 ; LARGE: ldw r0, cp[.LCPI{{[0-9_]*}}]
 ; LARGE-NEXT: ldw r0, r0[0]
 ; LARGE-NEXT: retsp 0
- at NoSize = external global [0 x i32]
+ at NoSize = external dso_local global [0 x i32]
 define i32 @UnknownSize() nounwind {
 entry:
   %0 = load i32, i32* getelementptr inbounds ([0 x i32], [0 x i32]* @NoSize, i32 0, i32 10)
@@ -150,7 +150,7 @@ entry:
 ; LARGE: ldw r0, cp[.LCPI{{[0-9_]*}}]
 ; LARGE-NEXT: retsp 0
 %Struct = type opaque
- at Unknown = external global %Struct
+ at Unknown = external dso_local global %Struct
 define %Struct* @UnknownStruct() nounwind {
 entry:
   ret %Struct* @Unknown

diff  --git a/llvm/test/CodeGen/XCore/offset_folding.ll b/llvm/test/CodeGen/XCore/offset_folding.ll
index ab29ad587a50..8a633eef79b8 100644
--- a/llvm/test/CodeGen/XCore/offset_folding.ll
+++ b/llvm/test/CodeGen/XCore/offset_folding.ll
@@ -1,7 +1,7 @@
 ; RUN: llc < %s -march=xcore | FileCheck %s
 
- at a = external constant [0 x i32], section ".cp.rodata"
- at b = external global [0 x i32]
+ at a = external dso_local constant [0 x i32], section ".cp.rodata"
+ at b = external dso_local global [0 x i32]
 
 define i32 *@f1() nounwind {
 entry:

diff  --git a/llvm/test/DebugInfo/X86/fission-ranges.ll b/llvm/test/DebugInfo/X86/fission-ranges.ll
index bb6320f73f72..1ee80872fae1 100644
--- a/llvm/test/DebugInfo/X86/fission-ranges.ll
+++ b/llvm/test/DebugInfo/X86/fission-ranges.ll
@@ -119,7 +119,7 @@
 
 ; clang -g -S -gsplit-dwarf -O1 small.c
 
- at c = external global i32
+ at c = external dso_local global i32
 
 ; Function Attrs: nounwind uwtable
 define void @bar() #0 !dbg !4 {

diff  --git a/llvm/test/Transforms/CodeGenPrepare/X86/sink-addrmode-select.ll b/llvm/test/Transforms/CodeGenPrepare/X86/sink-addrmode-select.ll
index 12edf44a03a3..89c76866c624 100644
--- a/llvm/test/Transforms/CodeGenPrepare/X86/sink-addrmode-select.ll
+++ b/llvm/test/Transforms/CodeGenPrepare/X86/sink-addrmode-select.ll
@@ -17,8 +17,8 @@ entry:
   ret i64 %v
 }
 
- at gv1 = external global i8, align 16
- at gv2 = external global i8, align 16
+ at gv1 = external dso_local global i8, align 16
+ at gv2 = external dso_local global i8, align 16
 
 ; Select when both GV and base reg are present.
 define i8 @test2(i1 %c, i64 %b) {

diff  --git a/llvm/test/tools/gold/X86/relocation-model-pic.ll b/llvm/test/tools/gold/X86/relocation-model-pic.ll
index 98034e49b0a0..30a55da8698e 100644
--- a/llvm/test/tools/gold/X86/relocation-model-pic.ll
+++ b/llvm/test/tools/gold/X86/relocation-model-pic.ll
@@ -1,9 +1,4 @@
-; RUN: cat %s >%t.pic.ll
-; RUN: echo '!llvm.module.flags = !{!0}' >>%t.pic.ll
-; RUN: echo '!0 = !{i32 1, !"PIC Level", i32 2}' >>%t.pic.ll
-
 ; RUN: llvm-as %s -o %t.o
-; RUN: llvm-as %t.pic.ll -o %t.pic.o
 
 ;; Non-PIC source.
 
@@ -17,36 +12,26 @@
 ; RUN:    --plugin-opt=save-temps %t.o -o %t-out
 ; RUN: llvm-readobj -r %t-out.lto.o | FileCheck %s --check-prefix=PIC
 
-; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
-; RUN:    --export-dynamic --noinhibit-exec \
-; RUN:    --plugin-opt=save-temps %t.o -o %t-out
-; RUN: llvm-readobj -r %t-out.lto.o | FileCheck %s --check-prefix=STATIC
-
-; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
-; RUN:    -r \
-; RUN:    --plugin-opt=save-temps %t.o -o %t-out
-; RUN: llvm-readobj -r %t-out.lto.o | FileCheck %s --check-prefix=STATIC
-
 ;; PIC source.
 
 ; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
 ; RUN:    --shared \
-; RUN:    --plugin-opt=save-temps %t.pic.o -o %t-out
+; RUN:    --plugin-opt=save-temps %t.o -o %t-out
 ; RUN: llvm-readobj -r %t-out.lto.o | FileCheck %s --check-prefix=PIC
 
 ; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
 ; RUN:    --export-dynamic --noinhibit-exec -pie \
-; RUN:    --plugin-opt=save-temps %t.pic.o -o %t-out
+; RUN:    --plugin-opt=save-temps %t.o -o %t-out
 ; RUN: llvm-readobj -r %t-out.lto.o | FileCheck %s --check-prefix=PIC
 
 ; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
 ; RUN:    --export-dynamic --noinhibit-exec \
-; RUN:    --plugin-opt=save-temps %t.pic.o -o %t-out
+; RUN:    --plugin-opt=save-temps %t.o -o %t-out
 ; RUN: llvm-readobj -r %t-out.lto.o | FileCheck %s --check-prefix=STATIC
 
 ; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
 ; RUN:    -r \
-; RUN:    --plugin-opt=save-temps %t.pic.o -o %t-out
+; RUN:    --plugin-opt=save-temps %t.o -o %t-out
 ; RUN: llvm-readobj -r %t-out.lto.o | FileCheck %s --check-prefix=PIC
 
 
@@ -61,3 +46,6 @@ define i32 @main() {
   %t = load i32, i32* @foo
   ret i32 %t
 }
+
+!llvm.module.flags = !{!0}
+!0 = !{i32 1, !"PIC Level", i32 2}

diff  --git a/llvm/test/tools/gold/X86/relocation-model-static.ll b/llvm/test/tools/gold/X86/relocation-model-static.ll
new file mode 100644
index 000000000000..157fbbd42971
--- /dev/null
+++ b/llvm/test/tools/gold/X86/relocation-model-static.ll
@@ -0,0 +1,23 @@
+; RUN: llvm-as %s -o %t.o
+
+;; --noinhibit-exec allows undefined foo.
+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
+; RUN:    --export-dynamic --noinhibit-exec \
+; RUN:    --plugin-opt=save-temps %t.o -o %t-out
+; RUN: llvm-readobj -r %t-out.lto.o | FileCheck %s --check-prefix=STATIC
+
+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
+; RUN:    -r \
+; RUN:    --plugin-opt=save-temps %t.o -o %t-out
+; RUN: llvm-readobj -r %t-out.lto.o | FileCheck %s --check-prefix=STATIC
+
+; STATIC: R_X86_64_PC32 foo
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+ at foo = external dso_local global i32
+define i32 @main() {
+  %t = load i32, i32* @foo
+  ret i32 %t
+}


        


More information about the llvm-branch-commits mailing list