forked from OSchip/llvm-project
[IR] Optimize no-op removal from AttributeSet (NFC)
When removing an AttrBuilder from an AttributeSet, first check whether there is any overlap. If nothing is being removed, we can directly return the original set.
This commit is contained in:
parent
6f9ac11e39
commit
fd46ed3f39
|
@ -781,8 +781,12 @@ AttributeSet AttributeSet::removeAttribute(LLVMContext &C,
|
|||
}
|
||||
|
||||
AttributeSet AttributeSet::removeAttributes(LLVMContext &C,
|
||||
const AttrBuilder &Attrs) const {
|
||||
const AttrBuilder &Attrs) const {
|
||||
AttrBuilder B(*this);
|
||||
// If there is nothing to remove, directly return the original set.
|
||||
if (!B.overlaps(Attrs))
|
||||
return *this;
|
||||
|
||||
B.remove(Attrs);
|
||||
return get(C, B);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue