[llvm] [HipStdPar] Avoid repeated hash lookups (NFC) (PR #112653)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 16 20:33:32 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/112653.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/HipStdPar/HipStdPar.cpp (+1-3)
``````````diff
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.");
``````````
</details>
https://github.com/llvm/llvm-project/pull/112653
More information about the llvm-commits
mailing list