From 67c2b4eab45b0cbe33e4c8c34cdd25b429131a06 Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Fri, 7 Mar 2025 14:45:28 -0800 Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?= =?UTF-8?q?l=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created using spr 1.3.4 --- llvm/include/llvm/IR/ModuleSummaryIndex.h | 44 +++++++++++++++-------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h index 3c586a1dd21d8..ada6bb259dc37 100644 --- a/llvm/include/llvm/IR/ModuleSummaryIndex.h +++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h @@ -1289,6 +1289,30 @@ struct TypeIdSummary { std::map WPDRes; }; +class CfiFunctionIndex { + std::set> Index; + +public: + CfiFunctionIndex() = default; + + template + CfiFunctionIndex(It B, It E) : Index(B, E) {} + + std::set>::const_iterator begin() const { + return Index.begin(); + } + + std::set>::const_iterator end() const { + return Index.end(); + } + + template void emplace(Args &&...A) { + Index.emplace(std::forward(A)...); + } + + size_t count(StringRef S) const { return Index.count(S); } +}; + /// 160 bits SHA1 using ModuleHash = std::array; @@ -1418,8 +1442,8 @@ class ModuleSummaryIndex { /// True if some of the FunctionSummary contains a ParamAccess. bool HasParamAccess = false; - std::set> CfiFunctionDefs; - std::set> CfiFunctionDecls; + CfiFunctionIndex CfiFunctionDefs; + CfiFunctionIndex CfiFunctionDecls; // Used in cases where we want to record the name of a global, but // don't have the string owned elsewhere (e.g. the Strtab on a module). @@ -1667,19 +1691,11 @@ class ModuleSummaryIndex { return I == OidGuidMap.end() ? 0 : I->second; } - std::set> &cfiFunctionDefs() { - return CfiFunctionDefs; - } - const std::set> &cfiFunctionDefs() const { - return CfiFunctionDefs; - } + CfiFunctionIndex &cfiFunctionDefs() { return CfiFunctionDefs; } + const CfiFunctionIndex &cfiFunctionDefs() const { return CfiFunctionDefs; } - std::set> &cfiFunctionDecls() { - return CfiFunctionDecls; - } - const std::set> &cfiFunctionDecls() const { - return CfiFunctionDecls; - } + CfiFunctionIndex &cfiFunctionDecls() { return CfiFunctionDecls; } + const CfiFunctionIndex &cfiFunctionDecls() const { return CfiFunctionDecls; } /// Add a global value summary for a value. void addGlobalValueSummary(const GlobalValue &GV,