Skip to content

Commit 130a47b

Browse files
committed
[ORC] Preserve order of constructors with same priority
Constructors with the same priority should keep their relative order that was specified. This is important for clang-repl with many const variables after commit 05137ecfca ("[clang-repl] Emit const variables only once"). --- Fixes #15511 (version of commit a60f353 for LLVM 13 in v6-30-00-patches)
1 parent ab2e7d8 commit 130a47b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ROOT-llvm13-20240318-01
1+
ROOT-llvm13-20240614-01

interpreter/llvm-project/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,8 @@ GlobalCtorDtorScraper::operator()(ThreadSafeModule TSM,
481481
std::vector<std::pair<Function *, unsigned>> Inits;
482482
for (auto E : getConstructors(M))
483483
Inits.push_back(std::make_pair(E.Func, E.Priority));
484-
llvm::sort(Inits, [](const std::pair<Function *, unsigned> &LHS,
485-
const std::pair<Function *, unsigned> &RHS) {
484+
llvm::stable_sort(Inits, [](const std::pair<Function *, unsigned> &LHS,
485+
const std::pair<Function *, unsigned> &RHS) {
486486
return LHS.second < RHS.second;
487487
});
488488
auto *EntryBlock = BasicBlock::Create(Ctx, "entry", InitFunc);

0 commit comments

Comments
 (0)