Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TableGen] Avoid repeated hash lookups (NFC) #109372

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -896,9 +896,8 @@ static void OCL2Qual(Sema &S, const OpenCLTypeStruct &Ty,
if (ImageTypesMap.contains(T->getValueAsString("Name")))
continue;
// Check we have not seen this Type
if (TypesSeen.contains(T->getValueAsString("Name")))
if (!TypesSeen.try_emplace(T->getValueAsString("Name"), true).second)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty weird, can we make it a StringSet instead? Doesn't look like the value is used.

continue;
TypesSeen.insert(std::make_pair(T->getValueAsString("Name"), true));

// Check the Type does not have an "abstract" QualType
auto QT = T->getValueAsDef("QTExpr");
Expand Down Expand Up @@ -1081,9 +1080,8 @@ void OpenCLBuiltinFileEmitterBase::expandTypesInSignature(
// the full type name to the extension.
StringRef Ext =
Type->getValueAsDef("Extension")->getValueAsString("ExtName");
if (!Ext.empty() && !TypeExtMap.contains(FullType)) {
TypeExtMap.insert({FullType, Ext});
}
if (!Ext.empty())
TypeExtMap.try_emplace(FullType, Ext);
}
}
NumSignatures = std::max<unsigned>(NumSignatures, ExpandedArg.size());
Expand Down
Loading