-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
[DebugInfo] Use heterogenous lookups with std::map (NFC) #132354
[DebugInfo] Use heterogenous lookups with std::map (NFC) #132354
Conversation
Heterogenous lookups allow us to call find with StringRef, avoiding a temporary heap allocation of std::string.
@llvm/pr-subscribers-debuginfo Author: Kazu Hirata (kazutakahirata) ChangesHeterogenous lookups allow us to call find with StringRef, avoiding a Full diff: https://github.com/llvm/llvm-project/pull/132354.diff 2 Files Affected:
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h
index f51571aa24c38..595215ba35dd5 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h
@@ -37,7 +37,7 @@ struct AggregationData {
class OutputCategoryAggregator {
private:
- std::map<std::string, AggregationData> Aggregation;
+ std::map<std::string, AggregationData, std::less<>> Aggregation;
bool IncludeDetail;
public:
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
index 05bb829cf44db..69027500ab51d 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -2194,7 +2194,7 @@ void OutputCategoryAggregator::EnumerateResults(
}
void OutputCategoryAggregator::EnumerateDetailedResultsFor(
StringRef category, std::function<void(StringRef, unsigned)> handleCounts) {
- const auto Agg = Aggregation.find(std::string(category));
+ const auto Agg = Aggregation.find(category);
if (Agg != Aggregation.end()) {
for (const auto &[name, aggData] : Agg->second.DetailedCounts) {
handleCounts(name, aggData);
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/30/builds/18128 Here is the relevant piece of the build log for the reference
|
Heterogenous lookups allow us to call find with StringRef, avoiding a
temporary heap allocation of std::string.