[llvm] [UniformityAnalysis] Use DenseSet for DivergentValues (PR #93455)
via llvm-commits
llvm-commits at lists.llvm.org
Mon May 27 03:20:49 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-adt
Author: Pierre van Houtryve (Pierre-vh)
<details>
<summary>Changes</summary>
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
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.
``````````
</details>
https://github.com/llvm/llvm-project/pull/93455
More information about the llvm-commits
mailing list