[llvm] f355a44 - [HipStdPar] Avoid repeated hash lookups (NFC) (#123558)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 20 10:13:31 PST 2025


Author: Kazu Hirata
Date: 2025-01-20T10:13:27-08:00
New Revision: f355a447634d6498fc5765771a9579564510654f

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

LOG: [HipStdPar] Avoid repeated hash lookups (NFC) (#123558)

Added: 
    

Modified: 
    llvm/lib/Transforms/HipStdPar/HipStdPar.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/HipStdPar/HipStdPar.cpp b/llvm/lib/Transforms/HipStdPar/HipStdPar.cpp
index 92042ddab38dc7..895c8c9d48681e 100644
--- a/llvm/lib/Transforms/HipStdPar/HipStdPar.cpp
+++ b/llvm/lib/Transforms/HipStdPar/HipStdPar.cpp
@@ -279,10 +279,11 @@ HipStdParAllocationInterpositionPass::run(Module &M, ModuleAnalysisManager&) {
   for (auto &&F : M) {
     if (!F.hasName())
       continue;
-    if (!AllocReplacements.contains(F.getName()))
+    auto It = AllocReplacements.find(F.getName());
+    if (It == AllocReplacements.end())
       continue;
 
-    if (auto R = M.getFunction(AllocReplacements[F.getName()])) {
+    if (auto R = M.getFunction(It->second)) {
       F.replaceAllUsesWith(R);
     } else {
       std::string W;


        


More information about the llvm-commits mailing list