Author: Dhruv Chawla
Date: 2023-06-10T12:36:43+05:30
New Revision: 8e580b7edd15e3a7fcf5951be14fb3fed519349a
URL:
https://github.com/llvm/llvm-project/commit/8e580b7edd15e3a7fcf5951be14fb3fed519349a
DIFF:
https://github.com/llvm/llvm-project/commit/8e580b7edd15e3a7fcf5951be14fb3fed519349a.diff
LOG: [NFC][SetVector] Update some usages of SetVector to SmallSetVector
This patch is a continuation of D152497. It updates usages of SetVector
that were found in llvm/ and clang/ which were originally specifying either
SmallPtrSet or SmallVector to just using SmallSetVector, as the overhead
of SetVector is reduced with D152497.
This also helps clean up the code a fair bit, and gives a decent speed
boost at -O0 (~0.2%):
https://llvm-compile-time-tracker.com/compare.php?from=9ffdabecabcddde298ff313f5353f9e06590af62&to=97f1c0cde42ba85eaa67cbe89bec8fe45b801f21&stat=instructions%3Au
Differential Revision: https://reviews.llvm.org/D152522
Added:
Modified:
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaOverload.cpp
clang/lib/Sema/SemaStmt.cpp
llvm/include/llvm/ADT/GenericCycleInfo.h
llvm/include/llvm/CodeGen/LiveRangeEdit.h
llvm/include/llvm/Transforms/Scalar/SROA.h
llvm/lib/Analysis/InlineCost.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
Removed:
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index b335a04dc473a..18da1ffb9402e 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -792,8 +792,7 @@ class Sema final {
/// we won't know until all lvalue-to-rvalue and discarded value conversions
/// have been applied to all subexpressions of the enclosing full expression.
/// This is cleared at the end of each full expression.
- using MaybeODRUseExprSet = llvm::SetVector,
- llvm::SmallPtrSet>;
+ using MaybeODRUseExprSet = llvm::SmallSetVector;
MaybeODRUseExprSet MaybeODRUseExprs;
std::unique_ptr CachedFunctionScope;
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 18f09e5a42e9b..14361d85cf182 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -8024,8 +8024,7 @@ namespace {
/// enumeration types.
class BuiltinCandidateTypeSet {
/// TypeSet - A set of types.
- typedef llvm::SetVector,
- llvm::SmallPtrSet> TypeSet;
+ typedef llvm::SmallSetVector TypeSet;
/// PointerTypes - The set of pointer types that will be used in the
/// built-in candidates.
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index bc9490ad04bf8..a87b0d9501930 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -1729,9 +1729,7 @@ Sema::ActOnDoStmt(SourceLocation DoLoc, Stmt *Body,
namespace {
// Use SetVector since the diagnostic cares about the ordering of the Decl's.
- using DeclSetVector =
- llvm::SetVector,
- llvm::SmallPtrSet>;
+ using DeclSetVector = llvm::SmallSetVector;
// This visitor will traverse a conditional statement and store all
// the evaluated decls into a vector. Simple is set to true if none
diff --git a/llvm/include/llvm/ADT/GenericCycleInfo.h
b/llvm/include/llvm/ADT/GenericCycleInfo.h
index 5dec7c97a0688..7df50f4a0ec17 100644
--- a/llvm/include/llvm/ADT/GenericCycleInfo.h
+++ b/llvm/include/llvm/ADT/GenericCycleInfo.h
@@ -28,10 +28,10 @@
#ifndef LLVM_ADT_GENERICCYCLEINFO_H
#define LLVM_ADT_GENERICCYCLEINFO_H
+#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/GenericSSAContext.h"
#include "llvm/ADT/GraphTraits.h"
#include "llvm/ADT/SetVector.h"
-#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
@@ -64,7 +64,7 @@ template class GenericCycle {
/// Basic blocks that are contained in the cycle, including entry blocks,
/// and including blocks that are part of a child cycle.
using BlockSetVectorT = SetVector,
-SmallPtrSet>;
+DenseSet, 8>;
BlockSetVectorT Blocks;
/// Depth of the cycle in the tree. The root "cycle" is at depth 0.
diff --git a/llvm/include/llvm/CodeGen/LiveRangeEdit.h
b/llvm/include/llvm/CodeGen/LiveRangeEdit.h
index fe7af0a8fb45b..0950c20325fb0 100644
--- a/llvm/include/llvm/CodeGen/LiveRangeEdit.h
+++ b/llvm/include/llvm/CodeGen/LiveRangeEdit.h
@@ -97,8 +97,7 @@ class LiveRangeEdit : private MachineRegisterInfo::Delegate {
/// a load, eliminate the register by folding the def into the use.
bool foldAsLoad(LiveInterval *LI, SmallVectorImpl &Dead);
- using ToShrinkSet = SetVector,
-SmallPtrSet>;
+ using ToShrinkSet = SmallSetVector;
/// Helper for eliminateDeadDefs.
void eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink);
diff --git a/llvm/include