[llvm] 8def128 - [UniformityAnalysis] Use DenseSet for DivergentValues (#93455)

via llvm-commits llvm-commits at lists.llvm.org
Mon May 27 05:11:04 PDT 2024


Author: Pierre van Houtryve
Date: 2024-05-27T14:11:00+02:00
New Revision: 8def1288d226008fe7a9128f1d81d6dfa172387e

URL: https://github.com/llvm/llvm-project/commit/8def1288d226008fe7a9128f1d81d6dfa172387e
DIFF: https://github.com/llvm/llvm-project/commit/8def1288d226008fe7a9128f1d81d6dfa172387e.diff

LOG: [UniformityAnalysis] Use DenseSet for DivergentValues (#93455)

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.

Added: 
    

Modified: 
    llvm/include/llvm/ADT/GenericUniformityImpl.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/GenericUniformityImpl.h b/llvm/include/llvm/ADT/GenericUniformityImpl.h
index 6b744384051b5..bd09f4fe43e08 100644
--- a/llvm/include/llvm/ADT/GenericUniformityImpl.h
+++ b/llvm/include/llvm/ADT/GenericUniformityImpl.h
@@ -46,14 +46,13 @@
 
 #include "llvm/ADT/GenericUniformityInfo.h"
 
+#include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallPtrSet.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.


        


More information about the llvm-commits mailing list