From 2669abaecfc47d4d2436559ab8c1fb49ad6e35c3 Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Mon, 3 May 2021 20:05:38 -0700 Subject: [clang][CodeGen] Use llvm::stable_sort for multi version resolver options The use of llvm::sort causes periodic failures on the bot with EXPENSIVE_CHECKS enabled, as the regular sort pre-shuffles the array in the expensive checks mode, leading to a non-deterministic test result which causes the CodeGenCXX/attr-cpuspecific-outoflinedefs.cpp testcase to fail on the bot (http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/). --- clang/lib/CodeGen/CodeGenModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 8d4a0e0855b1..cb0523898c3a 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -3344,7 +3344,7 @@ void CodeGenModule::emitCPUDispatchDefinition(GlobalDecl GD) { ++Index; } - llvm::sort( + llvm::stable_sort( Options, [](const CodeGenFunction::MultiVersionResolverOption &LHS, const CodeGenFunction::MultiVersionResolverOption &RHS) { return CodeGenFunction::GetX86CpuSupportsMask(LHS.Conditions.Features) > -- cgit v1.2.3