[llvm] r175235 - Simplify the attributes '<' comparison function.

Bill Wendling wendling at apple.com
Thu Feb 14 21:03:35 PST 2013


Thanks for reverting. Sorry for the breakage...

-bw

On Feb 14, 2013, at 8:18 PM, Anna Zaks <ganna at apple.com> wrote:

> Reverted this and the fellow commits in r175248- r175250.
> 
> Anna.
> On Feb 14, 2013, at 4:55 PM, Bill Wendling <isanbard at gmail.com> wrote:
> 
>> Author: void
>> Date: Thu Feb 14 18:55:08 2013
>> New Revision: 175235
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=175235&view=rev
>> Log:
>> Simplify the attributes '<' comparison function.
>> 
>> Modified:
>>   llvm/trunk/lib/IR/Attributes.cpp
>> 
>> Modified: llvm/trunk/lib/IR/Attributes.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Attributes.cpp?rev=175235&r1=175234&r2=175235&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/IR/Attributes.cpp (original)
>> +++ llvm/trunk/lib/IR/Attributes.cpp Thu Feb 14 18:55:08 2013
>> @@ -332,25 +332,23 @@ StringRef AttributeImpl::getValueAsStrin
>> 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.isAlignAttribute() || AI.isEnumAttribute())
>> -      return getKindAsEnum() < AI.getKindAsEnum();
>> -
>> -  if (isAlignAttribute()) {
>> -    if (!AI.isStringAttribute() && getKindAsEnum() < AI.getKindAsEnum())
>> -      return true;
>> -    if (AI.isAlignAttribute())
>> -      return getValueAsInt() < AI.getValueAsInt();
>> +  if (isEnumAttribute()) {
>> +    if (AI.isEnumAttribute()) return getKindAsEnum() < AI.getKindAsEnum();
>> +    if (AI.isAlignAttribute()) return true;
>> +    if (AI.isStringAttribute()) return true;
>>  }
>> 
>> -  if (isStringAttribute()) {
>> -    if (!AI.isStringAttribute()) return false;
>> -    if (getKindAsString() < AI.getKindAsString()) return true;
>> -    if (getKindAsString() == AI.getKindAsString())
>> -      return getValueAsString() < AI.getValueAsString();
>> +  if (isAlignAttribute()) {
>> +    if (AI.isEnumAttribute()) return false;
>> +    if (AI.isAlignAttribute()) return getValueAsInt() < AI.getValueAsInt();
>> +    if (AI.isStringAttribute()) return true;
>>  }
>> 
>> -  return false;
>> +  if (AI.isEnumAttribute()) return false;
>> +  if (AI.isAlignAttribute()) return false;
>> +  if (getKindAsString() == AI.getKindAsString())
>> +    return getValueAsString() < AI.getValueAsString();
>> +  return getKindAsString() < AI.getKindAsString();
>> }
>> 
>> uint64_t AttributeImpl::getAttrMask(Attribute::AttrKind Val) {
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list