summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/GlobalMerge.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/GlobalMerge.cpp')
-rw-r--r--llvm/lib/CodeGen/GlobalMerge.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/GlobalMerge.cpp b/llvm/lib/CodeGen/GlobalMerge.cpp
index f4526c64f1e..69d1e13cec7 100644
--- a/llvm/lib/CodeGen/GlobalMerge.cpp
+++ b/llvm/lib/CodeGen/GlobalMerge.cpp
@@ -462,17 +462,8 @@ bool GlobalMerge::doMerge(const SmallVectorImpl<GlobalVariable *> &Globals,
for (j = i; j != -1; j = GlobalSet.find_next(j)) {
Type *Ty = Globals[j]->getValueType();
- // Make sure we use the same alignment AsmPrinter would use. There
- // currently isn't any helper to compute that, so we compute it
- // explicitly here.
- //
- // getPreferredAlignment will sometimes return an alignment higher
- // than the explicitly specified alignment; we must ignore that
- // if the section is explicitly specified, to avoid inserting extra
- // padding into that section.
+ // Make sure we use the same alignment AsmPrinter would use.
unsigned Align = DL.getPreferredAlignment(Globals[j]);
- if (Globals[j]->hasSection() && Globals[j]->getAlignment())
- Align = Globals[j]->getAlignment();
unsigned Padding = alignTo(MergedSize, Align) - MergedSize;
MergedSize += Padding;
MergedSize += DL.getTypeAllocSize(Ty);
OpenPOWER on IntegriCloud