[llvm] 474b20b - [LLParser] Avoid unnecessary AttrBuilder<->AttributeSet roundtrip (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 18 08:57:28 PST 2021
Author: Nikita Popov
Date: 2021-12-18T17:57:15+01:00
New Revision: 474b20b45053aa790bb425528b3f98ebd2f75120
URL: https://github.com/llvm/llvm-project/commit/474b20b45053aa790bb425528b3f98ebd2f75120
DIFF: https://github.com/llvm/llvm-project/commit/474b20b45053aa790bb425528b3f98ebd2f75120.diff
LOG: [LLParser] Avoid unnecessary AttrBuilder<->AttributeSet roundtrip (NFC)
This was creating an AttributeSet from an AttrBuilder, and then
(implicitly) constructing an AttrBuilder from the AttributeSet,
and then the method would internally convert that back into an
AttributeSet. Instead, directly pass the AttrBuilder.
Added:
Modified:
llvm/lib/AsmParser/LLParser.cpp
Removed:
################################################################################
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index e187caf0767fe..8fdeceec92905 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -152,28 +152,28 @@ bool LLParser::validateEndOfModule(bool UpgradeDebugInfo) {
FnAttrs.removeAttribute(Attribute::Alignment);
}
- AS = AS.addFnAttributes(Context, AttributeSet::get(Context, FnAttrs));
+ AS = AS.addFnAttributes(Context, FnAttrs);
Fn->setAttributes(AS);
} else if (CallInst *CI = dyn_cast<CallInst>(V)) {
AttributeList AS = CI->getAttributes();
AttrBuilder FnAttrs(AS.getFnAttrs());
AS = AS.removeFnAttributes(Context);
FnAttrs.merge(B);
- AS = AS.addFnAttributes(Context, AttributeSet::get(Context, FnAttrs));
+ AS = AS.addFnAttributes(Context, FnAttrs);
CI->setAttributes(AS);
} else if (InvokeInst *II = dyn_cast<InvokeInst>(V)) {
AttributeList AS = II->getAttributes();
AttrBuilder FnAttrs(AS.getFnAttrs());
AS = AS.removeFnAttributes(Context);
FnAttrs.merge(B);
- AS = AS.addFnAttributes(Context, AttributeSet::get(Context, FnAttrs));
+ AS = AS.addFnAttributes(Context, FnAttrs);
II->setAttributes(AS);
} else if (CallBrInst *CBI = dyn_cast<CallBrInst>(V)) {
AttributeList AS = CBI->getAttributes();
AttrBuilder FnAttrs(AS.getFnAttrs());
AS = AS.removeFnAttributes(Context);
FnAttrs.merge(B);
- AS = AS.addFnAttributes(Context, AttributeSet::get(Context, FnAttrs));
+ AS = AS.addFnAttributes(Context, FnAttrs);
CBI->setAttributes(AS);
} else if (auto *GV = dyn_cast<GlobalVariable>(V)) {
AttrBuilder Attrs(GV->getAttributes());
More information about the llvm-commits
mailing list