[llvm] db32924 - [HipStdPar] Avoid repeated hash lookups (NFC) (#112653)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 17 07:44:34 PDT 2024
Author: Kazu Hirata
Date: 2024-10-17T07:44:27-07:00
New Revision: db3292402565042dff9a2d5a147e023de6d82263
URL: https://github.com/llvm/llvm-project/commit/db3292402565042dff9a2d5a147e023de6d82263
DIFF: https://github.com/llvm/llvm-project/commit/db3292402565042dff9a2d5a147e023de6d82263.diff
LOG: [HipStdPar] Avoid repeated hash lookups (NFC) (#112653)
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 d740500ef1f8f6..b909bf5b2d7b61 100644
--- a/llvm/lib/Transforms/HipStdPar/HipStdPar.cpp
+++ b/llvm/lib/Transforms/HipStdPar/HipStdPar.cpp
@@ -86,15 +86,13 @@ static inline bool checkIfSupported(GlobalVariable &G) {
auto U = std::move(Tmp.back());
Tmp.pop_back();
- if (Visited.contains(U))
+ if (!Visited.insert(U).second)
continue;
if (isa<Instruction>(U))
I = cast<Instruction>(U);
else
Tmp.insert(Tmp.end(), U->user_begin(), U->user_end());
-
- Visited.insert(U);
} while (!I && !Tmp.empty());
assert(I && "thread_local global should have at least one non-constant use.");
More information about the llvm-commits
mailing list