Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Oct 17, 2024

@llvm/pr-subscribers-llvm-transforms

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/112653.diff

1 Files Affected:

  • (modified) llvm/lib/Transforms/HipStdPar/HipStdPar.cpp (+1-3)
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.");

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kazutakahirata kazutakahirata merged commit db32924 into llvm:main Oct 17, 2024
10 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_repeated_hash_HipStdPar branch January 18, 2025 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants