Skip to content

[UniformityAnalysis] Use DenseSet for DivergentValues #93455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 27, 2024

Conversation

Pierre-vh
Copy link
Contributor

Values are small, and std::set is just unnecessarily expensive. It stood out in some quick performance profiling. DenseSet is a better alternative in this case.

…lues

Values are small, and std::set is just unnecessarily expensive. It stood out in some quick performance profiling.
@Pierre-vh Pierre-vh requested a review from ssahasra May 27, 2024 10:20
@llvmbot
Copy link
Member

llvmbot commented May 27, 2024

@llvm/pr-subscribers-llvm-adt

Author: Pierre van Houtryve (Pierre-vh)

Changes

Values are small, and std::set is just unnecessarily expensive. It stood out in some quick performance profiling. DenseSet is a better alternative in this case.


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

1 Files Affected:

  • (modified) llvm/include/llvm/ADT/GenericUniformityImpl.h (+2-3)
diff --git a/llvm/include/llvm/ADT/GenericUniformityImpl.h b/llvm/include/llvm/ADT/GenericUniformityImpl.h
index 6b744384051b5..e170b10441bbb 100644
--- a/llvm/include/llvm/ADT/GenericUniformityImpl.h
+++ b/llvm/include/llvm/ADT/GenericUniformityImpl.h
@@ -48,12 +48,11 @@
 
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/SparseBitVector.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/raw_ostream.h"
 
-#include <set>
-
 #define DEBUG_TYPE "uniformity"
 
 namespace llvm {
@@ -413,7 +412,7 @@ template <typename ContextT> class GenericUniformityAnalysisImpl {
   const TargetTransformInfo *TTI = nullptr;
 
   // Detected/marked divergent values.
-  std::set<ConstValueRefT> DivergentValues;
+  DenseSet<ConstValueRefT> DivergentValues;
   SmallPtrSet<const BlockT *, 32> DivergentTermBlocks;
 
   // Internal worklist for divergence propagation.

Copy link

github-actions bot commented May 27, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Collaborator

@ssahasra ssahasra left a comment

Choose a reason for hiding this comment

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

LGTM!

@Pierre-vh Pierre-vh merged commit 8def128 into llvm:main May 27, 2024
7 checks passed
@Pierre-vh Pierre-vh deleted the ua-use-denseset branch May 27, 2024 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants