Author: Fangrui Song
Date: 2024-06-20T21:45:40-07:00
New Revision: 255986e27fcf9f0b36f7a23fbe030fcca1ba0249

URL: 
https://github.com/llvm/llvm-project/commit/255986e27fcf9f0b36f7a23fbe030fcca1ba0249
DIFF: 
https://github.com/llvm/llvm-project/commit/255986e27fcf9f0b36f7a23fbe030fcca1ba0249.diff

LOG: [Driver] BuildOffloadingActions: Stabilize iteration order

Otherwise hip-phases.hip could fail when llvm::hash_value(StringRef)
changes.

Added: 
    

Modified: 
    clang/lib/Driver/Driver.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 67bf0604acd6e..0298d22203d9d 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -4595,6 +4595,7 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
     for (const ToolChain *TC : ToolChains)
       for (StringRef Arch : getOffloadArchs(C, Args, Kind, TC))
         TCAndArchs.push_back(std::make_pair(TC, Arch));
+    llvm::sort(TCAndArchs, llvm::less_second());
 
     for (unsigned I = 0, E = TCAndArchs.size(); I != E; ++I)
       DeviceActions.push_back(C.MakeAction<InputAction>(*InputArg, InputType));


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to