From: Bill Wendling Date: Tue, 9 Oct 2012 20:55:16 +0000 (+0000) Subject: Use a single location for calculating the alignments. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5abc0ef174908c099d3e1659f5e4675f8eddbaf4;p=platform%2Fupstream%2Fllvm.git Use a single location for calculating the alignments. llvm-svn: 165547 --- diff --git a/llvm/lib/VMCore/Attributes.cpp b/llvm/lib/VMCore/Attributes.cpp index 88f20e9..c176fed 100644 --- a/llvm/lib/VMCore/Attributes.cpp +++ b/llvm/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 {