diff options
author | Cameron Zwarich <zwarich@apple.com> | 2011-06-29 22:24:25 +0000 |
---|---|---|
committer | Cameron Zwarich <zwarich@apple.com> | 2011-06-29 22:24:25 +0000 |
commit | 34c8f51d65a477427044253856206caa721fbf02 (patch) | |
tree | 13fdac79ce4e905a4c6efb2e5a2e909095571fa6 /llvm/lib/Target/ARM/ARMGlobalMerge.cpp | |
parent | 8cc04599070eb2cf5485f32a2f70c1084e13bf47 (diff) | |
download | bcm5719-llvm-34c8f51d65a477427044253856206caa721fbf02.tar.gz bcm5719-llvm-34c8f51d65a477427044253856206caa721fbf02.zip |
In the ARM global merging pass, allow extraneous alignment specifiers. This pass
already makes the assumption, which is correct on ARM, that a type's alignment is
less than its alloc size. This improves codegen with Clang (which inserts a lot of
extraneous alignment specifiers) and fixes <rdar://problem/9695089>.
llvm-svn: 134106
Diffstat (limited to 'llvm/lib/Target/ARM/ARMGlobalMerge.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMGlobalMerge.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Target/ARM/ARMGlobalMerge.cpp b/llvm/lib/Target/ARM/ARMGlobalMerge.cpp index 3f0238387a2..4bdd4f12d76 100644 --- a/llvm/lib/Target/ARM/ARMGlobalMerge.cpp +++ b/llvm/lib/Target/ARM/ARMGlobalMerge.cpp @@ -175,7 +175,9 @@ bool ARMGlobalMerge::doInitialization(Module &M) { continue; // Ignore fancy-aligned globals for now. - if (I->getAlignment() != 0) + unsigned Alignment = I->getAlignment(); + unsigned AllocSize = TD->getTypeAllocSize(I->getType()->getElementType()); + if (Alignment > AllocSize) continue; // Ignore all 'special' globals. @@ -183,7 +185,7 @@ bool ARMGlobalMerge::doInitialization(Module &M) { I->getName().startswith(".llvm.")) continue; - if (TD->getTypeAllocSize(I->getType()->getElementType()) < MaxOffset) { + if (AllocSize < MaxOffset) { const TargetLoweringObjectFile &TLOF = TLI->getObjFileLowering(); if (TLOF.getKindForGlobal(I, TLI->getTargetMachine()).isBSSLocal()) BSSGlobals.push_back(I); |