[llvm-commits] [llvm] r165547 - /llvm/trunk/lib/VMCore/Attributes.cpp
Bill Wendling
isanbard at gmail.com
Tue Oct 9 13:55:16 PDT 2012
Author: void
Date: Tue Oct 9 15:55:16 2012
New Revision: 165547
URL: http://llvm.org/viewvc/llvm-project?rev=165547&view=rev
Log:
Use a single location for calculating the alignments.
Modified:
llvm/trunk/lib/VMCore/Attributes.cpp
Modified: llvm/trunk/lib/VMCore/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Attributes.cpp?rev=165547&r1=165546&r2=165547&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Attributes.cpp (original)
+++ llvm/trunk/lib/VMCore/Attributes.cpp Tue Oct 9 15:55:16 2012
@@ -75,17 +75,13 @@
/// This returns the alignment field of an attribute as a byte alignment value.
unsigned Attributes::getAlignment() const {
- if (!hasAttribute(Attributes::Alignment))
- return 0;
- return 1U << ((Attrs.getAlignment() >> 16) - 1);
+ return Attrs.getAlignment();
}
/// This returns the stack alignment field of an attribute as a byte alignment
/// value.
unsigned Attributes::getStackAlignment() const {
- if (!hasAttribute(Attributes::StackAlignment))
- return 0;
- return 1U << ((Attrs.getStackAlignment() >> 26) - 1);
+ return Attrs.getStackAlignment();
}
bool Attributes::isEmptyOrSingleton() const {
@@ -249,8 +245,6 @@
}
uint64_t Attributes::Builder::getAlignment() const {
- if (!hasAlignmentAttr())
- return 0;
return 1U <<
(((Bits & AttributesImpl::getAttrMask(Attributes::Alignment)) >> 16) - 1);
}
@@ -306,11 +300,11 @@
}
uint64_t AttributesImpl::getAlignment() const {
- return Bits & getAttrMask(Attributes::Alignment);
+ return 1U << (((Bits & getAttrMask(Attributes::Alignment)) >> 16) - 1);
}
uint64_t AttributesImpl::getStackAlignment() const {
- return Bits & getAttrMask(Attributes::StackAlignment);
+ return 1U << (((Bits & getAttrMask(Attributes::StackAlignment)) >> 26) - 1);
}
bool AttributesImpl::isEmptyOrSingleton() const {
More information about the llvm-commits
mailing list