From: Anna Zaks Date: Fri, 15 Feb 2013 04:15:55 +0000 (+0000) Subject: Revert "Simplify the attributes '<' comparison function." X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a7e4409bb238ec3c5169c25afbb0308ae76d1111;p=oota-llvm.git Revert "Simplify the attributes '<' comparison function." This reverts commit 82c101153fe7b35bce48781fab038e1b8f31a7bd. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175250 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/IR/Attributes.cpp b/lib/IR/Attributes.cpp index 629679c6831..3de304e7608 100644 --- a/lib/IR/Attributes.cpp +++ b/lib/IR/Attributes.cpp @@ -332,23 +332,25 @@ StringRef AttributeImpl::getValueAsString() const { bool AttributeImpl::operator<(const AttributeImpl &AI) const { // This sorts the attributes with Attribute::AttrKinds coming first (sorted // relative to their enum value) and then strings. - if (isEnumAttribute()) { - if (AI.isEnumAttribute()) return getKindAsEnum() < AI.getKindAsEnum(); - if (AI.isAlignAttribute()) return true; - if (AI.isStringAttribute()) return true; - } + if (isEnumAttribute()) + if (AI.isAlignAttribute() || AI.isEnumAttribute()) + return getKindAsEnum() < AI.getKindAsEnum(); if (isAlignAttribute()) { - if (AI.isEnumAttribute()) return false; - if (AI.isAlignAttribute()) return getValueAsInt() < AI.getValueAsInt(); - if (AI.isStringAttribute()) return true; + if (!AI.isStringAttribute() && getKindAsEnum() < AI.getKindAsEnum()) + return true; + if (AI.isAlignAttribute()) + return getValueAsInt() < AI.getValueAsInt(); + } + + if (isStringAttribute()) { + if (!AI.isStringAttribute()) return false; + if (getKindAsString() < AI.getKindAsString()) return true; + if (getKindAsString() == AI.getKindAsString()) + return getValueAsString() < AI.getValueAsString(); } - if (AI.isEnumAttribute()) return false; - if (AI.isAlignAttribute()) return false; - if (getKindAsString() == AI.getKindAsString()) - return getValueAsString() < AI.getValueAsString(); - return getKindAsString() < AI.getKindAsString(); + return false; } uint64_t AttributeImpl::getAttrMask(Attribute::AttrKind Val) {