forked from OSchip/llvm-project
Simplify the 'operator<' for the attribute object.
llvm-svn: 175252
This commit is contained in:
parent
283f4f0e66
commit
26b95756c1
|
@ -332,25 +332,23 @@ StringRef AttributeImpl::getValueAsString() const {
|
||||||
bool AttributeImpl::operator<(const AttributeImpl &AI) const {
|
bool AttributeImpl::operator<(const AttributeImpl &AI) const {
|
||||||
// This sorts the attributes with Attribute::AttrKinds coming first (sorted
|
// This sorts the attributes with Attribute::AttrKinds coming first (sorted
|
||||||
// relative to their enum value) and then strings.
|
// relative to their enum value) and then strings.
|
||||||
if (isEnumAttribute())
|
if (isEnumAttribute()) {
|
||||||
if (AI.isAlignAttribute() || AI.isEnumAttribute())
|
if (AI.isEnumAttribute()) return getKindAsEnum() < AI.getKindAsEnum();
|
||||||
return getKindAsEnum() < AI.getKindAsEnum();
|
if (AI.isAlignAttribute()) return true;
|
||||||
|
if (AI.isStringAttribute()) return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (isAlignAttribute()) {
|
if (isAlignAttribute()) {
|
||||||
if (!AI.isStringAttribute() && getKindAsEnum() < AI.getKindAsEnum())
|
if (AI.isEnumAttribute()) return false;
|
||||||
return true;
|
if (AI.isAlignAttribute()) return getValueAsInt() < AI.getValueAsInt();
|
||||||
if (AI.isAlignAttribute())
|
if (AI.isStringAttribute()) return true;
|
||||||
return getValueAsInt() < AI.getValueAsInt();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isStringAttribute()) {
|
if (AI.isEnumAttribute()) return false;
|
||||||
if (!AI.isStringAttribute()) return false;
|
if (AI.isAlignAttribute()) return false;
|
||||||
if (getKindAsString() < AI.getKindAsString()) return true;
|
if (getKindAsString() == AI.getKindAsString())
|
||||||
if (getKindAsString() == AI.getKindAsString())
|
return getValueAsString() < AI.getValueAsString();
|
||||||
return getValueAsString() < AI.getValueAsString();
|
return getKindAsString() < AI.getKindAsString();
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t AttributeImpl::getAttrMask(Attribute::AttrKind Val) {
|
uint64_t AttributeImpl::getAttrMask(Attribute::AttrKind Val) {
|
||||||
|
|
|
@ -98,7 +98,7 @@ entry:
|
||||||
ret i32 0
|
ret i32 0
|
||||||
; CHECK: @test5(
|
; CHECK: @test5(
|
||||||
; CHECK: store i8 4
|
; 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.
|
;; Noop memcpy should be zapped.
|
||||||
|
@ -123,7 +123,7 @@ entry:
|
||||||
%call = call i32 @g(%struct.p* align 8 byval %agg.tmp) nounwind
|
%call = call i32 @g(%struct.p* align 8 byval %agg.tmp) nounwind
|
||||||
ret i32 %call
|
ret i32 %call
|
||||||
; CHECK: @test7
|
; 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)
|
declare i32 @g(%struct.p* align 8 byval)
|
||||||
|
|
Loading…
Reference in New Issue