[lld] c92f204 - [lld] BPSectionOrderer: stabilize iteration order with MapVector
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 2 21:35:38 PST 2025
Author: Fangrui Song
Date: 2025-02-02T21:35:32-08:00
New Revision: c92f20416e6dbbde9790067b80e75ef1ef5d0fa4
URL: https://github.com/llvm/llvm-project/commit/c92f20416e6dbbde9790067b80e75ef1ef5d0fa4
DIFF: https://github.com/llvm/llvm-project/commit/c92f20416e6dbbde9790067b80e75ef1ef5d0fa4.diff
LOG: [lld] BPSectionOrderer: stabilize iteration order with MapVector
Added:
Modified:
lld/include/lld/Common/BPSectionOrdererBase.inc
Removed:
################################################################################
diff --git a/lld/include/lld/Common/BPSectionOrdererBase.inc b/lld/include/lld/Common/BPSectionOrdererBase.inc
index ed0e0826ec057f..adc3c21bb7b4d8 100644
--- a/lld/include/lld/Common/BPSectionOrdererBase.inc
+++ b/lld/include/lld/Common/BPSectionOrdererBase.inc
@@ -23,6 +23,7 @@
#include "llvm/ADT/CachedHashString.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
+#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
@@ -92,7 +93,7 @@ static SmallVector<std::pair<unsigned, UtilityNodes>> getUnsForCompression(
hashes.clear();
}
- DenseMap<uint64_t, unsigned> hashFrequency;
+ MapVector<uint64_t, unsigned> hashFrequency;
for (auto &[sectionIdx, hashes] : sectionHashes)
for (auto hash : hashes)
++hashFrequency[hash];
More information about the llvm-commits
mailing list