Skip to content

Commit

Permalink
[JITLink] Use MapVector to stabilize iteration order
Browse files Browse the repository at this point in the history
Otherwise LinkGraph::dump output could change
(llvm/test/ExecutionEngine/JITLink/x86-64/COFF_pdata_strip.s) when
llvm::hash_value(StringRef) changes.
  • Loading branch information
MaskRay committed Jun 20, 2024
1 parent fa00e8b commit f8f4235
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/FunctionExtras.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h"
Expand Down Expand Up @@ -847,7 +848,7 @@ class SectionRange {

class LinkGraph {
private:
using SectionMap = DenseMap<StringRef, std::unique_ptr<Section>>;
using SectionMap = MapVector<StringRef, std::unique_ptr<Section>>;
using ExternalSymbolMap = StringMap<Symbol *>;
using AbsoluteSymbolSet = DenseSet<Symbol *>;
using BlockSet = DenseSet<Block *>;
Expand Down Expand Up @@ -1543,7 +1544,7 @@ class LinkGraph {
unsigned PointerSize;
llvm::endianness Endianness;
GetEdgeKindNameFunction GetEdgeKindName = nullptr;
DenseMap<StringRef, std::unique_ptr<Section>> Sections;
MapVector<StringRef, std::unique_ptr<Section>> Sections;
ExternalSymbolMap ExternalSymbols;
AbsoluteSymbolSet AbsoluteSymbols;
orc::shared::AllocActions AAs;
Expand Down

0 comments on commit f8f4235

Please sign in to comment.