From a60f3538220e298f14c0ea5824d2fda91b71f39e Mon Sep 17 00:00:00 2001 From: Jonas Hahnfeld Date: Fri, 14 Jun 2024 14:15:31 +0200 Subject: [PATCH] [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 --- interpreter/llvm-project/llvm-project.tag | 2 +- interpreter/llvm-project/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/interpreter/llvm-project/llvm-project.tag b/interpreter/llvm-project/llvm-project.tag index acd21506d992c..6043a0be2bc05 100644 --- a/interpreter/llvm-project/llvm-project.tag +++ b/interpreter/llvm-project/llvm-project.tag @@ -1 +1 @@ -ROOT-llvm16-20240604-01 +ROOT-llvm16-20240614-01 diff --git a/interpreter/llvm-project/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/interpreter/llvm-project/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp index bc84988e32542..1d8f324738813 100644 --- a/interpreter/llvm-project/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp +++ b/interpreter/llvm-project/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp @@ -590,7 +590,7 @@ GlobalCtorDtorScraper::operator()(ThreadSafeModule TSM, for (auto E : COrDtors) InitsOrDeInits.push_back(std::make_pair(E.Func, E.Priority)); - llvm::sort(InitsOrDeInits, llvm::less_second()); + llvm::stable_sort(InitsOrDeInits, llvm::less_second()); auto *InitOrDeInitFuncEntryBlock = BasicBlock::Create(Ctx, "entry", InitOrDeInitFunc);