Fix <rdar://problem/9751331>.
authorCameron Zwarich <zwarich@apple.com>
Mon, 11 Jul 2011 01:29:42 +0000 (01:29 +0000)
committerCameron Zwarich <zwarich@apple.com>
Mon, 11 Jul 2011 01:29:42 +0000 (01:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134882 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMGlobalMerge.cpp

index 4bdd4f12d76c4503b9ffae94d66e9f32a14d6a44..f8993792bc67c45054bf57349c3023e9858cd47f 100644 (file)
@@ -176,8 +176,8 @@ bool ARMGlobalMerge::doInitialization(Module &M) {
 
     // Ignore fancy-aligned globals for now.
     unsigned Alignment = I->getAlignment();
 
     // Ignore fancy-aligned globals for now.
     unsigned Alignment = I->getAlignment();
-    unsigned AllocSize = TD->getTypeAllocSize(I->getType()->getElementType());
-    if (Alignment > AllocSize)
+    const Type *Ty = I->getType()->getElementType();
+    if (Alignment > TD->getABITypeAlignment(Ty))
       continue;
 
     // Ignore all 'special' globals.
       continue;
 
     // Ignore all 'special' globals.
@@ -185,7 +185,7 @@ bool ARMGlobalMerge::doInitialization(Module &M) {
         I->getName().startswith(".llvm."))
       continue;
 
         I->getName().startswith(".llvm."))
       continue;
 
-    if (AllocSize < MaxOffset) {
+    if (TD->getTypeAllocSize(Ty) < MaxOffset) {
       const TargetLoweringObjectFile &TLOF = TLI->getObjFileLowering();
       if (TLOF.getKindForGlobal(I, TLI->getTargetMachine()).isBSSLocal())
         BSSGlobals.push_back(I);
       const TargetLoweringObjectFile &TLOF = TLI->getObjFileLowering();
       if (TLOF.getKindForGlobal(I, TLI->getTargetMachine()).isBSSLocal())
         BSSGlobals.push_back(I);