diff options
author | Bill Wendling <isanbard@gmail.com> | 2012-10-09 20:55:16 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2012-10-09 20:55:16 +0000 |
commit | f8db977b68aabb0f1818badb68914b29cc66d460 (patch) | |
tree | a0cb581537f9a17729927562a1f09cadbdf48d91 /lib/VMCore/Attributes.cpp | |
parent | 1ed3b427fa0de2569351149fc5cb4638a41e9e98 (diff) |
Use a single location for calculating the alignments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165547 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Attributes.cpp')
-rw-r--r-- | lib/VMCore/Attributes.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp index 88f20e94a5..c176fed584 100644 --- a/lib/VMCore/Attributes.cpp +++ b/lib/VMCore/Attributes.cpp @@ -75,17 +75,13 @@ bool Attributes::hasAttributes(const Attributes &A) const { /// 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 @@ bool Attributes::Builder::hasAlignmentAttr() const { } uint64_t Attributes::Builder::getAlignment() const { - if (!hasAlignmentAttr()) - return 0; return 1U << (((Bits & AttributesImpl::getAttrMask(Attributes::Alignment)) >> 16) - 1); } @@ -306,11 +300,11 @@ bool AttributesImpl::hasAttributes(const Attributes &A) const { } 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 { |