[llvm] 0019d06 - Revert "Revert "[JITLink] Use MapVector to stabilize iteration order""
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 31 19:19:53 PDT 2024
Author: Lang Hames
Date: 2024-10-31T19:18:34-07:00
New Revision: 0019d06185428243066501c91ccbedb697a4a8a2
URL: https://github.com/llvm/llvm-project/commit/0019d06185428243066501c91ccbedb697a4a8a2
DIFF: https://github.com/llvm/llvm-project/commit/0019d06185428243066501c91ccbedb697a4a8a2.diff
LOG: Revert "Revert "[JITLink] Use MapVector to stabilize iteration order""
This reverts commit 244ea4062590b4fbda56bbae6cd3700159db19bf while I test a fix
for a build failure: https://lab.llvm.org/buildbot/#/builders/174/builds/7685.
Added:
Modified:
llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_associative_dead_strip.test
llvm/test/ExecutionEngine/JITLink/x86-64/COFF_pdata_strip.s
Removed:
################################################################################
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
index 75dcd9f597b2c8..e8a971bbfd2cb6 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
@@ -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"
@@ -853,7 +854,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 *>;
@@ -1595,7 +1596,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;
diff --git a/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp b/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
index ef382c3ce695a9..45ae70113aa26c 100644
--- a/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
@@ -291,18 +291,11 @@ void LinkGraph::dump(raw_ostream &OS) {
return false;
});
- std::vector<Section *> SortedSections;
- for (auto &Sec : sections())
- SortedSections.push_back(&Sec);
- llvm::sort(SortedSections, [](const Section *LHS, const Section *RHS) {
- return LHS->getName() < RHS->getName();
- });
-
- for (auto *Sec : SortedSections) {
- OS << "section " << Sec->getName() << ":\n\n";
+ for (auto &Sec : sections()) {
+ OS << "section " << Sec.getName() << ":\n\n";
std::vector<Block *> SortedBlocks;
- llvm::copy(Sec->blocks(), std::back_inserter(SortedBlocks));
+ llvm::copy(Sec.blocks(), std::back_inserter(SortedBlocks));
llvm::sort(SortedBlocks, [](const Block *LHS, const Block *RHS) {
return LHS->getAddress() < RHS->getAddress();
});
diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_associative_dead_strip.test b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_associative_dead_strip.test
index 29cac33c3e6f76..99f4d7a41bbcb1 100644
--- a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_associative_dead_strip.test
+++ b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_associative_dead_strip.test
@@ -7,10 +7,10 @@
# parent block is dead.
#
# CHECK: Link graph
-# CHECK-DAG: section child:
-# CHECK-EMPTY:
# CHECK-DAG: section parent:
# CHECK-EMPTY:
+# CHECK-DAG: section child:
+# CHECK-EMPTY:
--- !COFF
header:
diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_pdata_strip.s b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_pdata_strip.s
index 8b43e19d2ac4ca..a9caf7a763806d 100644
--- a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_pdata_strip.s
+++ b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_pdata_strip.s
@@ -8,9 +8,9 @@
#
# CHECK: section .func:
# CHECK-EMPTY:
-# CHECK-NEXT: section .pdata:
+# CHECK-NEXT: section .xdata:
# CHECK-EMPTY:
-# CHECK: section .xdata:
+# CHECK-NEXT: section .pdata:
# CHECK-EMPTY:
.text
More information about the llvm-commits
mailing list