[llvm] r244615 - [GlobalMerge] Use private linkage for MergedGlobals variables

John Brawn via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 08:48:04 PDT 2015


Author: john.brawn
Date: Tue Aug 11 10:48:04 2015
New Revision: 244615

URL: http://llvm.org/viewvc/llvm-project?rev=244615&view=rev
Log:
[GlobalMerge] Use private linkage for MergedGlobals variables

Other objects can never reference the MergedGlobals symbol so external linkage
is never needed. Using private instead of internal linkage means the object is
more similar to what it looks like when global merging is not enabled, with
the only difference being that the merged variables are addressed indirectly
relative to the start of the section they are in.

Also add aliases for merged variables with internal linkage, as this also makes
the object be more like what it is when they are not merged.

Differential Revision: http://reviews.llvm.org/D11942

Modified:
    llvm/trunk/lib/CodeGen/GlobalMerge.cpp
    llvm/trunk/test/CodeGen/AArch64/global-merge-1.ll
    llvm/trunk/test/CodeGen/AArch64/global-merge-2.ll
    llvm/trunk/test/CodeGen/AArch64/global-merge-3.ll
    llvm/trunk/test/CodeGen/AArch64/global-merge-4.ll
    llvm/trunk/test/CodeGen/AArch64/global-merge-group-by-use.ll
    llvm/trunk/test/CodeGen/AArch64/global-merge-ignore-single-use-minsize.ll
    llvm/trunk/test/CodeGen/AArch64/global-merge-ignore-single-use.ll
    llvm/trunk/test/CodeGen/ARM/2011-06-29-MergeGlobalsAlign.ll
    llvm/trunk/test/CodeGen/ARM/global-merge-1.ll
    llvm/trunk/test/CodeGen/ARM/global-merge-external.ll

Modified: llvm/trunk/lib/CodeGen/GlobalMerge.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalMerge.cpp?rev=244615&r1=244614&r2=244615&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalMerge.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalMerge.cpp Tue Aug 11 10:48:04 2015
@@ -429,8 +429,6 @@ bool GlobalMerge::doMerge(SmallVectorImp
     std::vector<Type*> Tys;
     std::vector<Constant*> Inits;
 
-    bool HasExternal = false;
-    GlobalVariable *TheFirstExternal = 0;
     for (j = i; j != -1; j = GlobalSet.find_next(j)) {
       Type *Ty = Globals[j]->getType()->getElementType();
       MergedSize += DL.getTypeAllocSize(Ty);
@@ -439,30 +437,14 @@ bool GlobalMerge::doMerge(SmallVectorImp
       }
       Tys.push_back(Ty);
       Inits.push_back(Globals[j]->getInitializer());
-
-      if (Globals[j]->hasExternalLinkage() && !HasExternal) {
-        HasExternal = true;
-        TheFirstExternal = Globals[j];
-      }
     }
 
-    // If merged variables doesn't have external linkage, we needn't to expose
-    // the symbol after merging.
-    GlobalValue::LinkageTypes Linkage = HasExternal
-                                            ? GlobalValue::ExternalLinkage
-                                            : GlobalValue::InternalLinkage;
-
     StructType *MergedTy = StructType::get(M.getContext(), Tys);
     Constant *MergedInit = ConstantStruct::get(MergedTy, Inits);
 
-    // If merged variables have external linkage, we use symbol name of the
-    // first variable merged as the suffix of global symbol name. This would
-    // be able to avoid the link-time naming conflict for globalm symbols.
     GlobalVariable *MergedGV = new GlobalVariable(
-        M, MergedTy, isConst, Linkage, MergedInit,
-        HasExternal ? "_MergedGlobals_" + TheFirstExternal->getName()
-                    : "_MergedGlobals",
-        nullptr, GlobalVariable::NotThreadLocal, AddrSpace);
+        M, MergedTy, isConst, GlobalValue::PrivateLinkage, MergedInit,
+        "_MergedGlobals", nullptr, GlobalVariable::NotThreadLocal, AddrSpace);
 
     for (ssize_t k = i, idx = 0; k != j; k = GlobalSet.find_next(k)) {
       GlobalValue::LinkageTypes Linkage = Globals[k]->getLinkage();
@@ -477,11 +459,9 @@ bool GlobalMerge::doMerge(SmallVectorImp
       Globals[k]->replaceAllUsesWith(GEP);
       Globals[k]->eraseFromParent();
 
-      if (Linkage != GlobalValue::InternalLinkage) {
-        // Generate a new alias...
-        auto *PTy = cast<PointerType>(GEP->getType());
-        GlobalAlias::create(PTy, Linkage, Name, GEP, &M);
-      }
+      // Generate a new alias...
+      auto *PTy = cast<PointerType>(GEP->getType());
+      GlobalAlias::create(PTy, Linkage, Name, GEP, &M);
 
       NumMerged++;
     }

Modified: llvm/trunk/test/CodeGen/AArch64/global-merge-1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/global-merge-1.ll?rev=244615&r1=244614&r2=244615&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/global-merge-1.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/global-merge-1.ll Tue Aug 11 10:48:04 2015
@@ -12,16 +12,16 @@
 
 define void @f1(i32 %a1, i32 %a2) {
 ;CHECK-APPLE-IOS-NOT: adrp
-;CHECK-APPLE-IOS: adrp	x8, __MergedGlobals at PAGE
+;CHECK-APPLE-IOS: adrp	x8, l__MergedGlobals at PAGE
 ;CHECK-APPLE-IOS-NOT: adrp
-;CHECK-APPLE-IOS: add	x8, x8, __MergedGlobals at PAGEOFF
+;CHECK-APPLE-IOS: add	x8, x8, l__MergedGlobals at PAGEOFF
   store i32 %a1, i32* @m, align 4
   store i32 %a2, i32* @n, align 4
   ret void
 }
 
-;CHECK:	.type	_MergedGlobals, at object  // @_MergedGlobals
-;CHECK:	.local	_MergedGlobals
-;CHECK:	.comm	_MergedGlobals,8,8
+;CHECK:	.type	.L_MergedGlobals, at object  // @_MergedGlobals
+;CHECK:	.local	.L_MergedGlobals
+;CHECK:	.comm	.L_MergedGlobals,8,8
 
-;CHECK-APPLE-IOS: .zerofill __DATA,__bss,__MergedGlobals,8,3 ; @_MergedGlobals
+;CHECK-APPLE-IOS: .zerofill __DATA,__bss,l__MergedGlobals,8,3 ; @_MergedGlobals

Modified: llvm/trunk/test/CodeGen/AArch64/global-merge-2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/global-merge-2.ll?rev=244615&r1=244614&r2=244615&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/global-merge-2.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/global-merge-2.ll Tue Aug 11 10:48:04 2015
@@ -9,8 +9,8 @@
 define void @f1(i32 %a1, i32 %a2) {
 ;CHECK-APPLE-IOS-LABEL: _f1:
 ;CHECK-APPLE-IOS-NOT: adrp
-;CHECK-APPLE-IOS: adrp	x8, __MergedGlobals_x at PAGE
-;CHECK-APPLE-IOS: add	x8, x8, __MergedGlobals_x at PAGEOFF
+;CHECK-APPLE-IOS: adrp	x8, l__MergedGlobals at PAGE
+;CHECK-APPLE-IOS: add	x8, x8, l__MergedGlobals at PAGEOFF
 ;CHECK-APPLE-IOS-NOT: adrp
   store i32 %a1, i32* @x, align 4
   store i32 %a2, i32* @y, align 4
@@ -19,34 +19,31 @@ define void @f1(i32 %a1, i32 %a2) {
 
 define void @g1(i32 %a1, i32 %a2) {
 ;CHECK-APPLE-IOS-LABEL: _g1:
-;CHECK-APPLE-IOS: adrp	x8, __MergedGlobals_x at PAGE
-;CHECK-APPLE-IOS: add	x8, x8, __MergedGlobals_x at PAGEOFF
+;CHECK-APPLE-IOS: adrp	x8, l__MergedGlobals at PAGE
+;CHECK-APPLE-IOS: add	x8, x8, l__MergedGlobals at PAGEOFF
 ;CHECK-APPLE-IOS-NOT: adrp
   store i32 %a1, i32* @y, align 4
   store i32 %a2, i32* @z, align 4
   ret void
 }
 
-;CHECK:	.type	_MergedGlobals_x, at object // @_MergedGlobals_x
-;CHECK:	.globl	_MergedGlobals_x
-;CHECK:	.align	3
-;CHECK: _MergedGlobals_x:
-;CHECK:	.size	_MergedGlobals_x, 12
+;CHECK:	.type	.L_MergedGlobals, at object // @_MergedGlobals
+;CHECK:	.local	.L_MergedGlobals
+;CHECK:	.comm	.L_MergedGlobals,12,8
 
 ;CHECK:	.globl	x
-;CHECK: x = _MergedGlobals_x
+;CHECK: x = .L_MergedGlobals
 ;CHECK:	.globl	y
-;CHECK: y = _MergedGlobals_x+4
+;CHECK: y = .L_MergedGlobals+4
 ;CHECK:	.globl	z
-;CHECK: z = _MergedGlobals_x+8
+;CHECK: z = .L_MergedGlobals+8
 
-;CHECK-APPLE-IOS: .globl	__MergedGlobals_x       ; @_MergedGlobals_x
-;CHECK-APPLE-IOS: .zerofill __DATA,__common,__MergedGlobals_x,12,3
+;CHECK-APPLE-IOS: .zerofill __DATA,__bss,l__MergedGlobals,12,3
 
 ;CHECK-APPLE-IOS: .globl	_x
-;CHECK-APPLE-IOS: _x = __MergedGlobals_x
+;CHECK-APPLE-IOS:  = l__MergedGlobals
 ;CHECK-APPLE-IOS: .globl	_y
-;CHECK-APPLE-IOS: _y = __MergedGlobals_x+4
+;CHECK-APPLE-IOS: _y = l__MergedGlobals+4
 ;CHECK-APPLE-IOS: .globl	_z
-;CHECK-APPLE-IOS: _z = __MergedGlobals_x+8
+;CHECK-APPLE-IOS: _z = l__MergedGlobals+8
 ;CHECK-APPLE-IOS: .subsections_via_symbols

Modified: llvm/trunk/test/CodeGen/AArch64/global-merge-3.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/global-merge-3.ll?rev=244615&r1=244614&r2=244615&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/global-merge-3.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/global-merge-3.ll Tue Aug 11 10:48:04 2015
@@ -7,11 +7,11 @@
 @z = internal global i32 1, align 4
 
 define void @f1(i32 %a1, i32 %a2, i32 %a3) {
-;CHECK-APPLE-IOS: adrp	x8, __MergedGlobals_x at PAGE
+;CHECK-APPLE-IOS: adrp	x8, l__MergedGlobals at PAGE
 ;CHECK-APPLE-IOS-NOT: adrp
-;CHECK-APPLE-IOS: add	x8, x8, __MergedGlobals_x at PAGEOFF
-;CHECK-APPLE-IOS: adrp	x9, __MergedGlobals_y at PAGE
-;CHECK-APPLE-IOS: add	x9, x9, __MergedGlobals_y at PAGEOFF
+;CHECK-APPLE-IOS: add	x8, x8, l__MergedGlobals at PAGEOFF
+;CHECK-APPLE-IOS: adrp	x9, l__MergedGlobals.1 at PAGE
+;CHECK-APPLE-IOS: add	x9, x9, l__MergedGlobals.1 at PAGEOFF
   %x3 = getelementptr inbounds [1000 x i32], [1000 x i32]* @x, i32 0, i64 3
   %y3 = getelementptr inbounds [1000 x i32], [1000 x i32]* @y, i32 0, i64 3
   store i32 %a1, i32* %x3, align 4
@@ -20,32 +20,28 @@ define void @f1(i32 %a1, i32 %a2, i32 %a
   ret void
 }
 
-;CHECK:	.type	_MergedGlobals_x, at object // @_MergedGlobals_x
-;CHECK: .globl	_MergedGlobals_x
+;CHECK:	.type	.L_MergedGlobals, at object // @_MergedGlobals
 ;CHECK: .align	4
-;CHECK: _MergedGlobals_x:
-;CHECK: .size	_MergedGlobals_x, 4004
+;CHECK: .L_MergedGlobals:
+;CHECK: .size	.L_MergedGlobals, 4004
 
-;CHECK: .type	_MergedGlobals_y, at object // @_MergedGlobals_y
-;CHECK: .globl	_MergedGlobals_y
-;CHECK: _MergedGlobals_y:
-;CHECK: .size	_MergedGlobals_y, 4000
+;CHECK: .type	.L_MergedGlobals.1, at object // @_MergedGlobals.1
+;CHECK: .local	.L_MergedGlobals.1
+;CHECK: .comm	.L_MergedGlobals.1,4000,16
 
-;CHECK-APPLE-IOS: .globl	__MergedGlobals_x       ; @_MergedGlobals_x
 ;CHECK-APPLE-IOS: .align	4
-;CHECK-APPLE-IOS:  __MergedGlobals_x:
+;CHECK-APPLE-IOS:  l__MergedGlobals:
 ;CHECK-APPLE-IOS: .long 1
 ;CHECK-APPLE-IOS: .space	4000
 
-;CHECK-APPLE-IOS: .globl	__MergedGlobals_y       ; @_MergedGlobals_y
-;CHECK-APPLE-IOS: .zerofill __DATA,__common,__MergedGlobals_y,4000,4
+;CHECK-APPLE-IOS: .zerofill __DATA,__bss,l__MergedGlobals.1,4000,4
 
 ;CHECK:	.globl	x
-;CHECK: x = _MergedGlobals_x+4
+;CHECK: x = .L_MergedGlobals+4
 ;CHECK:	.globl	y
-;CHECK: y = _MergedGlobals_y
+;CHECK: y = .L_MergedGlobals.1
 
 ;CHECK-APPLE-IOS:.globl	_x
-;CHECK-APPLE-IOS: _x = __MergedGlobals_x+4
+;CHECK-APPLE-IOS: _x = l__MergedGlobals+4
 ;CHECK-APPLE-IOS:.globl	_y
-;CHECK-APPLE-IOS: _y = __MergedGlobals_y
+;CHECK-APPLE-IOS: _y = l__MergedGlobals.1

Modified: llvm/trunk/test/CodeGen/AArch64/global-merge-4.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/global-merge-4.ll?rev=244615&r1=244614&r2=244615&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/global-merge-4.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/global-merge-4.ll Tue Aug 11 10:48:04 2015
@@ -64,9 +64,9 @@ define internal i32* @returnFoo() #1 {
   ret i32* getelementptr inbounds ([5 x i32], [5 x i32]* @foo, i64 0, i64 0)
 }
 
-;CHECK:	.type	_MergedGlobals, at object  // @_MergedGlobals
-;CHECK:	.local	_MergedGlobals
-;CHECK:	.comm	_MergedGlobals,60,16
+;CHECK:	.type	.L_MergedGlobals, at object  // @_MergedGlobals
+;CHECK:	.local	.L_MergedGlobals
+;CHECK:	.comm	.L_MergedGlobals,60,16
 
 attributes #0 = { nounwind ssp }
 attributes #1 = { nounwind readnone ssp }

Modified: llvm/trunk/test/CodeGen/AArch64/global-merge-group-by-use.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/global-merge-group-by-use.ll?rev=244615&r1=244614&r2=244615&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/global-merge-group-by-use.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/global-merge-group-by-use.ll Tue Aug 11 10:48:04 2015
@@ -12,7 +12,7 @@
 
 ; CHECK-LABEL: f1:
 define void @f1(i32 %a1, i32 %a2) #0 {
-; CHECK-NEXT: adrp x8, [[SET1:__MergedGlobals.[0-9]*]]@PAGE
+; CHECK-NEXT: adrp x8, [[SET1:l__MergedGlobals.[0-9]*]]@PAGE
 ; CHECK-NEXT: add x8, x8, [[SET1]]@PAGEOFF
 ; CHECK-NEXT: stp w0, w1, [x8]
 ; CHECK-NEXT: ret
@@ -27,7 +27,7 @@ define void @f1(i32 %a1, i32 %a2) #0 {
 
 ; CHECK-LABEL: f2:
 define void @f2(i32 %a1, i32 %a2, i32 %a3) #0 {
-; CHECK-NEXT: adrp x8, [[SET2:__MergedGlobals.[0-9]*]]@PAGE
+; CHECK-NEXT: adrp x8, [[SET2:l__MergedGlobals.[0-9]*]]@PAGE
 ; CHECK-NEXT: add x8, x8, [[SET2]]@PAGEOFF
 ; CHECK-NEXT: stp w0, w1, [x8]
 ; CHECK-NEXT: str w2, [x8, #8]
@@ -48,7 +48,7 @@ define void @f2(i32 %a1, i32 %a2, i32 %a
 ; CHECK-LABEL: f3:
 define void @f3(i32 %a1, i32 %a2) #0 {
 ; CHECK-NEXT: adrp x8, _m3 at PAGE
-; CHECK-NEXT: adrp x9, [[SET3:__MergedGlobals[0-9]*]]@PAGE
+; CHECK-NEXT: adrp x9, [[SET3:l__MergedGlobals[0-9]*]]@PAGE
 ; CHECK-NEXT: str w0, [x8, _m3 at PAGEOFF]
 ; CHECK-NEXT: str w1, [x9, [[SET3]]@PAGEOFF]
 ; CHECK-NEXT: ret

Modified: llvm/trunk/test/CodeGen/AArch64/global-merge-ignore-single-use-minsize.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/global-merge-ignore-single-use-minsize.ll?rev=244615&r1=244614&r2=244615&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/global-merge-ignore-single-use-minsize.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/global-merge-ignore-single-use-minsize.ll Tue Aug 11 10:48:04 2015
@@ -11,7 +11,7 @@
 
 ; CHECK-LABEL: f1:
 define void @f1(i32 %a1, i32 %a2) minsize nounwind {
-; CHECK-NEXT: adrp x8, [[SET:__MergedGlobals]]@PAGE
+; CHECK-NEXT: adrp x8, [[SET:l__MergedGlobals]]@PAGE
 ; CHECK-NEXT: add x8, x8, [[SET]]@PAGEOFF
 ; CHECK-NEXT: stp w0, w1, [x8]
 ; CHECK-NEXT: ret

Modified: llvm/trunk/test/CodeGen/AArch64/global-merge-ignore-single-use.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/global-merge-ignore-single-use.ll?rev=244615&r1=244614&r2=244615&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/global-merge-ignore-single-use.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/global-merge-ignore-single-use.ll Tue Aug 11 10:48:04 2015
@@ -10,7 +10,7 @@
 
 ; CHECK-LABEL: f1:
 define void @f1(i32 %a1, i32 %a2) #0 {
-; CHECK-NEXT: adrp x8, [[SET:__MergedGlobals]]@PAGE
+; CHECK-NEXT: adrp x8, [[SET:l__MergedGlobals]]@PAGE
 ; CHECK-NEXT: add x8, x8, [[SET]]@PAGEOFF
 ; CHECK-NEXT: stp w0, w1, [x8]
 ; CHECK-NEXT: ret

Modified: llvm/trunk/test/CodeGen/ARM/2011-06-29-MergeGlobalsAlign.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2011-06-29-MergeGlobalsAlign.ll?rev=244615&r1=244614&r2=244615&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/2011-06-29-MergeGlobalsAlign.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/2011-06-29-MergeGlobalsAlign.ll Tue Aug 11 10:48:04 2015
@@ -1,5 +1,5 @@
 ; RUN: llc < %s -mtriple=thumbv7-apple-darwin10 -arm-global-merge -global-merge-group-by-use=false | FileCheck %s
-; CHECK: .zerofill __DATA,__bss,__MergedGlobals,16,2
+; CHECK: .zerofill __DATA,__bss,l__MergedGlobals,16,2
 
 @prev = external global [0 x i16]
 @max_lazy_match = internal unnamed_addr global i32 0, align 4

Modified: llvm/trunk/test/CodeGen/ARM/global-merge-1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/global-merge-1.ll?rev=244615&r1=244614&r2=244615&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/global-merge-1.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/global-merge-1.ll Tue Aug 11 10:48:04 2015
@@ -11,16 +11,16 @@
 ; MERGE-NOT: .zerofill __DATA,__bss,_bar,20,2
 ; MERGE-NOT: .zerofill __DATA,__bss,_baz,20,2
 ; MERGE-NOT: .zerofill __DATA,__bss,_foo,20,2
-; MERGE: .zerofill __DATA,__bss,__MergedGlobals,60,4
+; MERGE: .zerofill __DATA,__bss,l__MergedGlobals,60,4
 ; MERGE-NOT: .zerofill __DATA,__bss,_bar,20,2
 ; MERGE-NOT: .zerofill __DATA,__bss,_baz,20,2
 ; MERGE-NOT: .zerofill __DATA,__bss,_foo,20,2
 
-; NO-MERGE-NOT: .zerofill __DATA,__bss,__MergedGlobals,60,4
+; NO-MERGE-NOT: .zerofill __DATA,__bss,l__MergedGlobals,60,4
 ; NO-MERGE: .zerofill __DATA,__bss,_bar,20,2
 ; NO-MERGE: .zerofill __DATA,__bss,_baz,20,2
 ; NO-MERGE: .zerofill __DATA,__bss,_foo,20,2
-; NO-MERGE-NOT: .zerofill __DATA,__bss,__MergedGlobals,60,4
+; NO-MERGE-NOT: .zerofill __DATA,__bss,l__MergedGlobals,60,4
 
 target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
 target triple = "thumbv7-apple-ios3.0.0"

Modified: llvm/trunk/test/CodeGen/ARM/global-merge-external.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/global-merge-external.ll?rev=244615&r1=244614&r2=244615&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/global-merge-external.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/global-merge-external.ll Tue Aug 11 10:48:04 2015
@@ -11,7 +11,7 @@ define void @f1(i32 %a1, i32 %a2) {
 ;CHECK:          f1:
 ;CHECK:          ldr {{r[0-9]+}}, [[LABEL1:\.LCPI[0-9]+_[0-9]]]
 ;CHECK:          [[LABEL1]]:
-;CHECK-MERGE:    .long _MergedGlobals_x
+;CHECK-MERGE:    .long .L_MergedGlobals
 ;CHECK-NO-MERGE: .long {{_?x}}
   store i32 %a1, i32* @x, align 4
   store i32 %a2, i32* @y, align 4
@@ -22,24 +22,22 @@ define void @g1(i32 %a1, i32 %a2) {
 ;CHECK:          g1:
 ;CHECK:          ldr {{r[0-9]+}}, [[LABEL2:\.LCPI[0-9]+_[0-9]]]
 ;CHECK:          [[LABEL2]]:
-;CHECK-MERGE:    .long _MergedGlobals_x
+;CHECK-MERGE:    .long .L_MergedGlobals
 ;CHECK-NO-MERGE: .long {{_?y}}
   store i32 %a1, i32* @y, align 4
   store i32 %a2, i32* @z, align 4
   ret void
 }
 
-;CHECK-NO-MERGE-NOT: .globl _MergedGlobals_x
+;CHECK-NO-MERGE-NOT: .globl .L_MergedGlobals
 
-;CHECK-MERGE:	.type	_MergedGlobals_x,%object
-;CHECK-MERGE:	.globl	_MergedGlobals_x
-;CHECK-MERGE:	.align	2
-;CHECK-MERGE: _MergedGlobals_x:
-;CHECK-MERGE:	.size	_MergedGlobals_x, 12
+;CHECK-MERGE:	.type	.L_MergedGlobals,%object
+;CHECK-MERGE:	.local	.L_MergedGlobals
+;CHECK-MERGE:	.comm	.L_MergedGlobals,12,4
 
 ;CHECK-MERGE:	.globl	x
-;CHECK-MERGE: x = _MergedGlobals_x
+;CHECK-MERGE: x = .L_MergedGlobals
 ;CHECK-MERGE:	.globl	y
-;CHECK-MERGE: y = _MergedGlobals_x+4
+;CHECK-MERGE: y = .L_MergedGlobals+4
 ;CHECK-MERGE:	.globl	z
-;CHECK-MERGE: z = _MergedGlobals_x+8
+;CHECK-MERGE: z = .L_MergedGlobals+8




More information about the llvm-commits mailing list