[llvm] [UniformityAnalysis] Use DenseSet for DivergentValues (PR #93455)
Pierre van Houtryve via llvm-commits
llvm-commits at lists.llvm.org
Mon May 27 03:34:55 PDT 2024
https://github.com/Pierre-vh updated https://github.com/llvm/llvm-project/pull/93455
>From d29aae586e650977881ed583e503faf4218ad3d0 Mon Sep 17 00:00:00 2001
From: pvanhout <pierre.vanhoutryve at amd.com>
Date: Mon, 27 May 2024 12:19:23 +0200
Subject: [PATCH 1/2] [UniformityAnalysis] Use DenseSet instead of std::set for
DivergentValues
Values are small, and std::set is just unnecessarily expensive. It stood out in some quick performance profiling.
---
llvm/include/llvm/ADT/GenericUniformityImpl.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
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.
>From 165e651cf4473b8b7762cd8213970af0ac48b1e4 Mon Sep 17 00:00:00 2001
From: pvanhout <pierre.vanhoutryve at amd.com>
Date: Mon, 27 May 2024 12:34:44 +0200
Subject: [PATCH 2/2] format
---
llvm/include/llvm/ADT/GenericUniformityImpl.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/include/llvm/ADT/GenericUniformityImpl.h b/llvm/include/llvm/ADT/GenericUniformityImpl.h
index e170b10441bbb..bd09f4fe43e08 100644
--- a/llvm/include/llvm/ADT/GenericUniformityImpl.h
+++ b/llvm/include/llvm/ADT/GenericUniformityImpl.h
@@ -46,9 +46,9 @@
#include "llvm/ADT/GenericUniformityInfo.h"
+#include "llvm/ADT/DenseSet.h"
#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"
More information about the llvm-commits
mailing list