diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-02-15 05:25:26 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-02-15 05:25:26 +0000 |
commit | 26b95756c1c640da31f1fb4837e4dce6990015e7 (patch) | |
tree | 82a4bb34e60f4c9269e75620f2027c2e50c7b8bc | |
parent | 283f4f0e66f547b96dcc86e649c2ef393029ea44 (diff) | |
download | bcm5719-llvm-26b95756c1c640da31f1fb4837e4dce6990015e7.tar.gz bcm5719-llvm-26b95756c1c640da31f1fb4837e4dce6990015e7.zip |
Simplify the 'operator<' for the attribute object.
llvm-svn: 175252
-rw-r--r-- | llvm/lib/IR/Attributes.cpp | 28 | ||||
-rw-r--r-- | llvm/test/Transforms/MemCpyOpt/memcpy.ll | 4 |
2 files changed, 15 insertions, 17 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index 3de304e7608..629679c6831 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -332,25 +332,23 @@ 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.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) { diff --git a/llvm/test/Transforms/MemCpyOpt/memcpy.ll b/llvm/test/Transforms/MemCpyOpt/memcpy.ll index c19a93a776c..3fbc559ccff 100644 --- a/llvm/test/Transforms/MemCpyOpt/memcpy.ll +++ b/llvm/test/Transforms/MemCpyOpt/memcpy.ll @@ -98,7 +98,7 @@ entry: ret i32 0 ; CHECK: @test5( ; CHECK: store i8 4 - ; CHECK: call void @test5a(%struct.S* align 16 byval %y) + ; CHECK: call void @test5a(%struct.S* byval align 16 %y) } ;; Noop memcpy should be zapped. @@ -123,7 +123,7 @@ entry: %call = call i32 @g(%struct.p* align 8 byval %agg.tmp) nounwind ret i32 %call ; CHECK: @test7 -; CHECK: call i32 @g(%struct.p* align 8 byval %q) nounwind +; CHECK: call i32 @g(%struct.p* byval align 8 %q) nounwind } declare i32 @g(%struct.p* align 8 byval) |