Skip to content

[LTO] Use DenseSet in computeLTOCacheKey (NFC) #105466

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

Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions llvm/include/llvm/LTO/LTO.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ std::string computeLTOCacheKey(
const FunctionImporter::ExportSetTy &ExportList,
const std::map<GlobalValue::GUID, GlobalValue::LinkageTypes> &ResolvedODR,
const GVSummaryMapTy &DefinedGlobals,
const std::set<GlobalValue::GUID> &CfiFunctionDefs = {},
const std::set<GlobalValue::GUID> &CfiFunctionDecls = {});
const DenseSet<GlobalValue::GUID> &CfiFunctionDefs = {},
const DenseSet<GlobalValue::GUID> &CfiFunctionDecls = {});

namespace lto {

Expand Down
12 changes: 6 additions & 6 deletions llvm/lib/LTO/LTO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ std::string llvm::computeLTOCacheKey(
const FunctionImporter::ExportSetTy &ExportList,
const std::map<GlobalValue::GUID, GlobalValue::LinkageTypes> &ResolvedODR,
const GVSummaryMapTy &DefinedGlobals,
const std::set<GlobalValue::GUID> &CfiFunctionDefs,
const std::set<GlobalValue::GUID> &CfiFunctionDecls) {
const DenseSet<GlobalValue::GUID> &CfiFunctionDefs,
const DenseSet<GlobalValue::GUID> &CfiFunctionDecls) {
// Compute the unique hash for this entry.
// This is based on the current compiler version, the module itself, the
// export list, the hash for every single module in the import list, the
Expand Down Expand Up @@ -237,9 +237,9 @@ std::string llvm::computeLTOCacheKey(
std::set<GlobalValue::GUID> UsedTypeIds;

auto AddUsedCfiGlobal = [&](GlobalValue::GUID ValueGUID) {
if (CfiFunctionDefs.count(ValueGUID))
if (CfiFunctionDefs.contains(ValueGUID))
UsedCfiDefs.insert(ValueGUID);
if (CfiFunctionDecls.count(ValueGUID))
if (CfiFunctionDecls.contains(ValueGUID))
UsedCfiDecls.insert(ValueGUID);
};

Expand Down Expand Up @@ -1429,8 +1429,8 @@ class InProcessThinBackend : public ThinBackendProc {
DefaultThreadPool BackendThreadPool;
AddStreamFn AddStream;
FileCache Cache;
std::set<GlobalValue::GUID> CfiFunctionDefs;
std::set<GlobalValue::GUID> CfiFunctionDecls;
DenseSet<GlobalValue::GUID> CfiFunctionDefs;
DenseSet<GlobalValue::GUID> CfiFunctionDecls;

std::optional<Error> Err;
std::mutex ErrMu;
Expand Down
Loading