[llvm] [HipStdPar] Avoid repeated hash lookups (NFC) (PR #123558)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 19 23:54:06 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/123558
None
>From 8ecbb688cadb03af3f51da52d1b574cff311341b Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 19 Jan 2025 12:06:26 -0800
Subject: [PATCH] [HipStdPar] Avoid repeated hash lookups (NFC)
---
llvm/lib/Transforms/HipStdPar/HipStdPar.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
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