Skip to content

Commit f267a39

Browse files
committed
Stabilize output order.
1 parent 1f3aea2 commit f267a39

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

llvm/lib/ExecutionEngine/Orc/Core.cpp

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3061,17 +3061,37 @@ Error ExecutionSession::OL_notifyEmitted(
30613061
LLVM_DEBUG({
30623062
dbgs() << " Simplified dependencies:\n";
30633063
for (auto &SN : SR.superNodes()) {
3064+
3065+
auto SortedLibs = [](WaitingOnGraph::ContainerElementsMap &C) {
3066+
std::vector<JITDylib *> JDs;
3067+
for (auto &[JD, _] : C)
3068+
JDs.push_back(JD);
3069+
llvm::sort(JDs, [](const JITDylib *LHS, const JITDylib *RHS) {
3070+
return LHS->getName() < RHS->getName();
3071+
});
3072+
return JDs;
3073+
};
3074+
3075+
auto SortedNames = [](WaitingOnGraph::ElementSet &Elems) {
3076+
std::vector<NonOwningSymbolStringPtr> Names(Elems.begin(), Elems.end());
3077+
llvm::sort(Names, [](const NonOwningSymbolStringPtr &LHS,
3078+
const NonOwningSymbolStringPtr &RHS) {
3079+
return *LHS < *RHS;
3080+
});
3081+
return Names;
3082+
};
3083+
30643084
dbgs() << " Defs: {";
3065-
for (auto &[JD, Syms] : SN->defs()) {
3085+
for (auto *JD : SortedLibs(SN->defs())) {
30663086
dbgs() << " (" << JD->getName() << ", [";
3067-
for (auto &Sym : Syms)
3087+
for (auto &Sym : SortedNames(SN->defs()[JD]))
30683088
dbgs() << " " << Sym;
30693089
dbgs() << " ])";
30703090
}
30713091
dbgs() << " }, Deps: {";
3072-
for (auto &[JD, Syms] : SN->deps()) {
3092+
for (auto *JD : SortedLibs(SN->deps())) {
30733093
dbgs() << " (" << JD->getName() << ", [";
3074-
for (auto &Sym : Syms)
3094+
for (auto &Sym : SortedNames(SN->deps()[JD]))
30753095
dbgs() << " " << Sym;
30763096
dbgs() << " ])";
30773097
}

0 commit comments

Comments
 (0)