forked from OSchip/llvm-project
[FunctionAttrs] Bulk remove attributes. NFC.
This commit is contained in:
parent
d678e14c55
commit
dce72dc870
|
@ -281,16 +281,18 @@ static bool addReadAttrs(const SCCNodeSet &SCCNodes, AARGetterT &&AARGetter) {
|
||||||
MadeChange = true;
|
MadeChange = true;
|
||||||
|
|
||||||
// Clear out any existing attributes.
|
// Clear out any existing attributes.
|
||||||
F->removeFnAttr(Attribute::ReadOnly);
|
AttrBuilder AttrsToRemove;
|
||||||
F->removeFnAttr(Attribute::ReadNone);
|
AttrsToRemove.addAttribute(Attribute::ReadOnly);
|
||||||
F->removeFnAttr(Attribute::WriteOnly);
|
AttrsToRemove.addAttribute(Attribute::ReadNone);
|
||||||
|
AttrsToRemove.addAttribute(Attribute::WriteOnly);
|
||||||
|
|
||||||
if (!WritesMemory && !ReadsMemory) {
|
if (!WritesMemory && !ReadsMemory) {
|
||||||
// Clear out any "access range attributes" if readnone was deduced.
|
// Clear out any "access range attributes" if readnone was deduced.
|
||||||
F->removeFnAttr(Attribute::ArgMemOnly);
|
AttrsToRemove.addAttribute(Attribute::ArgMemOnly);
|
||||||
F->removeFnAttr(Attribute::InaccessibleMemOnly);
|
AttrsToRemove.addAttribute(Attribute::InaccessibleMemOnly);
|
||||||
F->removeFnAttr(Attribute::InaccessibleMemOrArgMemOnly);
|
AttrsToRemove.addAttribute(Attribute::InaccessibleMemOrArgMemOnly);
|
||||||
}
|
}
|
||||||
|
F->removeAttributes(AttributeList::FunctionIndex, AttrsToRemove);
|
||||||
|
|
||||||
// Add in the new attribute.
|
// Add in the new attribute.
|
||||||
if (WritesMemory && !ReadsMemory)
|
if (WritesMemory && !ReadsMemory)
|
||||||
|
|
Loading…
Reference in New Issue