Skip to content

Commit 8bba3f0

Browse files
committed
[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.
1 parent 8db61ed commit 8bba3f0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

llvm/lib/ExecutionEngine/Orc/DebugUtils.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,12 @@ raw_ostream &operator<<(raw_ostream &OS, const SymbolState &S) {
298298

299299
raw_ostream &operator<<(raw_ostream &OS, const SymbolStringPool &SSP) {
300300
std::lock_guard<std::mutex> Lock(SSP.PoolMutex);
301+
SmallVector<std::pair<StringRef, int>, 0> Vec;
301302
for (auto &KV : SSP.Pool)
302-
OS << KV.first() << ": " << KV.second << "\n";
303+
Vec.emplace_back(KV.first(), KV.second);
304+
llvm::sort(Vec, less_first());
305+
for (auto &[K, V] : Vec)
306+
OS << K << ": " << V << "\n";
303307
return OS;
304308
}
305309

0 commit comments

Comments
 (0)