[clang] 2669aba - [clang][CodeGen] Use llvm::stable_sort for multi version resolver options

Alex Lorenz via cfe-commits cfe-commits at lists.llvm.org
Mon May 3 20:07:12 PDT 2021


Author: Alex Lorenz
Date: 2021-05-03T20:07:00-07:00
New Revision: 2669abaecfc47d4d2436559ab8c1fb49ad6e35c3

URL: https://github.com/llvm/llvm-project/commit/2669abaecfc47d4d2436559ab8c1fb49ad6e35c3
DIFF: https://github.com/llvm/llvm-project/commit/2669abaecfc47d4d2436559ab8c1fb49ad6e35c3.diff

LOG: [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/).

Added: 
    

Modified: 
    clang/lib/CodeGen/CodeGenModule.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 8d4a0e0855b11..cb0523898c3af 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) >


        


More information about the cfe-commits mailing list