aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2007-04-23 19:58:54 +0000
committerDale Johannesen <dalej@apple.com>2007-04-23 19:58:54 +0000
commit19f5469be4af517aa7953988a6d2e92cc05d4c62 (patch)
tree90b140233ba7c628a70dde2b1ac0b80152d0b31b /lib/CodeGen/AsmPrinter.cpp
parentd127c1b5f3785a4a957ccf70b79a96adfc223259 (diff)
make EmitAlignment work the way Chris says it should
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36368 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp
index 4dce674575..1266179a2c 100644
--- a/lib/CodeGen/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter.cpp
@@ -579,8 +579,10 @@ void AsmPrinter::EmitString(const std::string &String) const {
//===----------------------------------------------------------------------===//
// EmitAlignment - Emit an alignment directive to the specified power of two.
+// Use the maximum of the specified alignment and the alignment from the
+// specified GlobalValue (if any).
void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV) const {
- if (GV && GV->getAlignment())
+ if (GV && GV->getAlignment() && Log2_32(GV->getAlignment()) > NumBits)
NumBits = Log2_32(GV->getAlignment());
if (NumBits == 0) return; // No need to emit alignment.
if (TAI->getAlignmentIsInBytes()) NumBits = 1 << NumBits;