diff options
author | Craig Topper <craig.topper@intel.com> | 2020-08-28 13:02:42 -0700 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2020-08-28 13:23:45 -0700 |
commit | aab90384a3a7a475bc1a969405d112c886ce8077 (patch) | |
tree | 5719e08b035d929aa8b8ba1ebe6752d91c2d2e23 /llvm/lib/IR/Attributes.cpp | |
parent | 0becc27ebfec02c3d667785e55b366bc1a5336a7 (diff) | |
download | llvm-aab90384a3a7a475bc1a969405d112c886ce8077.zip llvm-aab90384a3a7a475bc1a969405d112c886ce8077.tar.gz llvm-aab90384a3a7a475bc1a969405d112c886ce8077.tar.bz2 |
[Attributes] Add a method to check if an Attribute has AttrKind None. Use instead of hasAttribute(Attribute::None)
There's a special case in hasAttribute for None when pImpl is null. If pImpl is not null we dispatch to pImpl->hasAttribute which will always return false for Attribute::None.
So if we just want to check for None its sufficient to just check that pImpl is null. Which can even be done inline.
This patch adds a helper for that case which I hope will speed up our getSubtargetImpl implementations.
Differential Revision: https://reviews.llvm.org/D86744
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r-- | llvm/lib/IR/Attributes.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index 43074e8..03939ee 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -1087,10 +1087,10 @@ AttributeList::get(LLVMContext &C, return LHS.first < RHS.first; }) && "Misordered Attributes list!"); - assert(llvm::none_of(Attrs, - [](const std::pair<unsigned, Attribute> &Pair) { - return Pair.second.hasAttribute(Attribute::None); - }) && + assert(llvm::all_of(Attrs, + [](const std::pair<unsigned, Attribute> &Pair) { + return Pair.second.isValid(); + }) && "Pointless attribute!"); // Create a vector if (unsigned, AttributeSetNode*) pairs from the attributes |