diff options
author | Anna Zaks <ganna@apple.com> | 2013-02-15 04:15:55 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2013-02-15 04:15:55 +0000 |
commit | 08b088dbbe7716039088930e4f0a25c497f64546 (patch) | |
tree | f5eb4529d51919778f38868565dacaa3c76abe7f /llvm/lib/IR/Attributes.cpp | |
parent | 269d1fa991f5d10d8299add35be8b03f5603c2ac (diff) | |
download | llvm-08b088dbbe7716039088930e4f0a25c497f64546.zip llvm-08b088dbbe7716039088930e4f0a25c497f64546.tar.gz llvm-08b088dbbe7716039088930e4f0a25c497f64546.tar.bz2 |
Revert "Simplify the attributes '<' comparison function."
This reverts commit 82c101153fe7b35bce48781fab038e1b8f31a7bd.
llvm-svn: 175250
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r-- | llvm/lib/IR/Attributes.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index 629679c..3de304e 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/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) { |