[llvm] 8bba3f0 - [ORC] Stabilize output stream order
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 22 09:52:18 PDT 2023
Author: Fangrui Song
Date: 2023-07-22T09:52:14-07:00
New Revision: 8bba3f0edbd0e0af03836a2da1cca9f0138e7e01
URL: https://github.com/llvm/llvm-project/commit/8bba3f0edbd0e0af03836a2da1cca9f0138e7e01
DIFF: https://github.com/llvm/llvm-project/commit/8bba3f0edbd0e0af03836a2da1cca9f0138e7e01.diff
LOG: [ORC] Stabilize output stream order
It currently depends on the StringMap iteration order, which is not
guaranteed to be deterministic. Use MapVector to stabilize the order.
Added:
Modified:
llvm/lib/ExecutionEngine/Orc/DebugUtils.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/Orc/DebugUtils.cpp b/llvm/lib/ExecutionEngine/Orc/DebugUtils.cpp
index 3404adf56a5655..aca45764221254 100644
--- a/llvm/lib/ExecutionEngine/Orc/DebugUtils.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/DebugUtils.cpp
@@ -298,8 +298,12 @@ raw_ostream &operator<<(raw_ostream &OS, const SymbolState &S) {
raw_ostream &operator<<(raw_ostream &OS, const SymbolStringPool &SSP) {
std::lock_guard<std::mutex> Lock(SSP.PoolMutex);
+ SmallVector<std::pair<StringRef, int>, 0> Vec;
for (auto &KV : SSP.Pool)
- OS << KV.first() << ": " << KV.second << "\n";
+ Vec.emplace_back(KV.first(), KV.second);
+ llvm::sort(Vec, less_first());
+ for (auto &[K, V] : Vec)
+ OS << K << ": " << V << "\n";
return OS;
}
More information about the llvm-commits
mailing list