[clang] 3d83912 - Revert rGfae7b98c221b5b28797f7b56b656b6b819d99f27 "[Support] Change SetVector's default template parameter to SmallVector<*, 0>"

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 25 02:22:23 PDT 2023


Author: Simon Pilgrim
Date: 2023-07-25T10:22:08+01:00
New Revision: 3d83912c0c7be63d24e54792b300f394931a363b

URL: https://github.com/llvm/llvm-project/commit/3d83912c0c7be63d24e54792b300f394931a363b
DIFF: https://github.com/llvm/llvm-project/commit/3d83912c0c7be63d24e54792b300f394931a363b.diff

LOG: Revert rGfae7b98c221b5b28797f7b56b656b6b819d99f27 "[Support] Change SetVector's default template parameter to SmallVector<*, 0>"

This is failing on Windows MSVC builds:
llvm\unittests\Support\ThreadPool.cpp(380): error C2440: 'return': cannot convert from 'Vector' to 'std::vector<llvm::BitVector,std::allocator<llvm::BitVector>>'
        with
        [
            Vector=llvm::SmallVector<llvm::BitVector,0>
        ]

Added: 
    

Modified: 
    clang/lib/CodeGen/CodeGenModule.cpp
    clang/lib/CodeGen/CodeGenModule.h
    llvm/include/llvm/ADT/SetVector.h
    llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
    llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.cpp
    mlir/include/mlir/Support/LLVM.h
    mlir/lib/Analysis/SliceAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 908dec42afabeb..07a9dec12f6f25 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -2236,7 +2236,7 @@ static bool requiresMemberFunctionPointerTypeMetadata(CodeGenModule &CGM,
          !isa<CXXDestructorDecl>(MD);
 }
 
-SmallVector<const CXXRecordDecl *, 0>
+std::vector<const CXXRecordDecl *>
 CodeGenModule::getMostBaseClasses(const CXXRecordDecl *RD) {
   llvm::SetVector<const CXXRecordDecl *> MostBases;
 

diff  --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h
index c5de947687ea61..f5fd94492540f2 100644
--- a/clang/lib/CodeGen/CodeGenModule.h
+++ b/clang/lib/CodeGen/CodeGenModule.h
@@ -1505,7 +1505,7 @@ class CodeGenModule : public CodeGenTypeCache {
   ///
   /// A most-base class of a class C is defined as a recursive base class of C,
   /// including C itself, that does not have any bases.
-  SmallVector<const CXXRecordDecl *, 0>
+  std::vector<const CXXRecordDecl *>
   getMostBaseClasses(const CXXRecordDecl *RD);
 
   /// Get the declaration of std::terminate for the platform.

diff  --git a/llvm/include/llvm/ADT/SetVector.h b/llvm/include/llvm/ADT/SetVector.h
index ff083556cf1694..781ca367b97e48 100644
--- a/llvm/include/llvm/ADT/SetVector.h
+++ b/llvm/include/llvm/ADT/SetVector.h
@@ -23,10 +23,10 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <iterator>
+#include <vector>
 
 namespace llvm {
 
@@ -52,7 +52,7 @@ namespace llvm {
 /// when searching for elements instead of checking Set, due to it being better
 /// for performance. A value of 0 means that this mode of operation is not used,
 /// and is the default value.
-template <typename T, typename Vector = SmallVector<T, 0>,
+template <typename T, typename Vector = std::vector<T>,
           typename Set = DenseSet<T>, unsigned N = 0>
 class SetVector {
   // Much like in SmallPtrSet, this value should not be too high to prevent

diff  --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
index 775bb95fdda7b0..2076ed48ea342a 100644
--- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
+++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
@@ -93,7 +93,7 @@ extern cl::opt<bool> ScalePartialSampleProfileWorkingSetSize;
 // instruction in it takes an address of any basic block, because instruction
 // can only take an address of basic block located in the same function.
 static bool findRefEdges(ModuleSummaryIndex &Index, const User *CurUser,
-                         SetVector<ValueInfo, std::vector<ValueInfo>> &RefEdges,
+                         SetVector<ValueInfo> &RefEdges,
                          SmallPtrSet<const User *, 8> &Visited) {
   bool HasBlockAddress = false;
   SmallVector<const User *, 32> Worklist;
@@ -144,12 +144,9 @@ static bool isNonRenamableLocal(const GlobalValue &GV) {
 
 /// Determine whether this call has all constant integer arguments (excluding
 /// "this") and summarize it to VCalls or ConstVCalls as appropriate.
-static void addVCallToSet(
-    DevirtCallSite Call, GlobalValue::GUID Guid,
-    SetVector<FunctionSummary::VFuncId, std::vector<FunctionSummary::VFuncId>>
-        &VCalls,
-    SetVector<FunctionSummary::ConstVCall,
-              std::vector<FunctionSummary::ConstVCall>> &ConstVCalls) {
+static void addVCallToSet(DevirtCallSite Call, GlobalValue::GUID Guid,
+                          SetVector<FunctionSummary::VFuncId> &VCalls,
+                          SetVector<FunctionSummary::ConstVCall> &ConstVCalls) {
   std::vector<uint64_t> Args;
   // Start from the second argument to skip the "this" pointer.
   for (auto &Arg : drop_begin(Call.CB.args())) {
@@ -166,18 +163,11 @@ static void addVCallToSet(
 /// If this intrinsic call requires that we add information to the function
 /// summary, do so via the non-constant reference arguments.
 static void addIntrinsicToSummary(
-    const CallInst *CI,
-    SetVector<GlobalValue::GUID, std::vector<GlobalValue::GUID>> &TypeTests,
-    SetVector<FunctionSummary::VFuncId, std::vector<FunctionSummary::VFuncId>>
-        &TypeTestAssumeVCalls,
-    SetVector<FunctionSummary::VFuncId, std::vector<FunctionSummary::VFuncId>>
-        &TypeCheckedLoadVCalls,
-    SetVector<FunctionSummary::ConstVCall,
-              std::vector<FunctionSummary::ConstVCall>>
-        &TypeTestAssumeConstVCalls,
-    SetVector<FunctionSummary::ConstVCall,
-              std::vector<FunctionSummary::ConstVCall>>
-        &TypeCheckedLoadConstVCalls,
+    const CallInst *CI, SetVector<GlobalValue::GUID> &TypeTests,
+    SetVector<FunctionSummary::VFuncId> &TypeTestAssumeVCalls,
+    SetVector<FunctionSummary::VFuncId> &TypeCheckedLoadVCalls,
+    SetVector<FunctionSummary::ConstVCall> &TypeTestAssumeConstVCalls,
+    SetVector<FunctionSummary::ConstVCall> &TypeCheckedLoadConstVCalls,
     DominatorTree &DT) {
   switch (CI->getCalledFunction()->getIntrinsicID()) {
   case Intrinsic::type_test:
@@ -279,14 +269,12 @@ static void computeFunctionSummary(
   MapVector<ValueInfo, CalleeInfo, DenseMap<ValueInfo, unsigned>,
             std::vector<std::pair<ValueInfo, CalleeInfo>>>
       CallGraphEdges;
-  SetVector<ValueInfo, std::vector<ValueInfo>> RefEdges, LoadRefEdges,
-      StoreRefEdges;
-  SetVector<GlobalValue::GUID, std::vector<GlobalValue::GUID>> TypeTests;
-  SetVector<FunctionSummary::VFuncId, std::vector<FunctionSummary::VFuncId>>
-      TypeTestAssumeVCalls, TypeCheckedLoadVCalls;
-  SetVector<FunctionSummary::ConstVCall,
-            std::vector<FunctionSummary::ConstVCall>>
-      TypeTestAssumeConstVCalls, TypeCheckedLoadConstVCalls;
+  SetVector<ValueInfo> RefEdges, LoadRefEdges, StoreRefEdges;
+  SetVector<GlobalValue::GUID> TypeTests;
+  SetVector<FunctionSummary::VFuncId> TypeTestAssumeVCalls,
+      TypeCheckedLoadVCalls;
+  SetVector<FunctionSummary::ConstVCall> TypeTestAssumeConstVCalls,
+      TypeCheckedLoadConstVCalls;
   ICallPromotionAnalysis ICallAnalysis;
   SmallPtrSet<const User *, 8> Visited;
 
@@ -517,7 +505,7 @@ static void computeFunctionSummary(
   std::vector<ValueInfo> Refs;
   if (IsThinLTO) {
     auto AddRefEdges = [&](const std::vector<const Instruction *> &Instrs,
-                           SetVector<ValueInfo, std::vector<ValueInfo>> &Edges,
+                           SetVector<ValueInfo> &Edges,
                            SmallPtrSet<const User *, 8> &Cache) {
       for (const auto *I : Instrs) {
         Cache.erase(I);
@@ -722,7 +710,7 @@ static void computeVariableSummary(ModuleSummaryIndex &Index,
                                    DenseSet<GlobalValue::GUID> &CantBePromoted,
                                    const Module &M,
                                    SmallVectorImpl<MDNode *> &Types) {
-  SetVector<ValueInfo, std::vector<ValueInfo>> RefEdges;
+  SetVector<ValueInfo> RefEdges;
   SmallPtrSet<const User *, 8> Visited;
   bool HasBlockAddress = findRefEdges(Index, &V, RefEdges, Visited);
   bool NonRenamableLocal = isNonRenamableLocal(V);

diff  --git a/llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.cpp b/llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.cpp
index 29863e06f174ba..52679f8ba0b003 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.cpp
@@ -155,7 +155,7 @@ opportunities(Function &F,
 
       // After all candidates have been added, it doesn't need to be a set
       // anymore.
-      auto Candidates = ReferencedVals.takeVector();
+      std::vector<Value *> Candidates = ReferencedVals.takeVector();
 
       // Remove ineligible candidates.
       llvm::erase_if(Candidates, [&, OpVal](Value *V) {

diff  --git a/mlir/include/mlir/Support/LLVM.h b/mlir/include/mlir/Support/LLVM.h
index 235d84c5beff12..fec0debc716699 100644
--- a/mlir/include/mlir/Support/LLVM.h
+++ b/mlir/include/mlir/Support/LLVM.h
@@ -122,7 +122,7 @@ template <typename KeyT, typename ValueT,
 using DenseMap = llvm::DenseMap<KeyT, ValueT, KeyInfoT, BucketT>;
 template <typename ValueT, typename ValueInfoT = DenseMapInfo<ValueT>>
 using DenseSet = llvm::DenseSet<ValueT, ValueInfoT>;
-template <typename T, typename Vector = llvm::SmallVector<T, 0>,
+template <typename T, typename Vector = std::vector<T>,
           typename Set = DenseSet<T>, unsigned N = 0>
 using SetVector = llvm::SetVector<T, Vector, Set, N>;
 template <typename AllocatorTy = llvm::MallocAllocator>

diff  --git a/mlir/lib/Analysis/SliceAnalysis.cpp b/mlir/lib/Analysis/SliceAnalysis.cpp
index 95ec6ab2bd7a49..9a5821da6343d4 100644
--- a/mlir/lib/Analysis/SliceAnalysis.cpp
+++ b/mlir/lib/Analysis/SliceAnalysis.cpp
@@ -62,7 +62,7 @@ void mlir::getForwardSlice(Operation *op, SetVector<Operation *> *forwardSlice,
   // Reverse to get back the actual topological order.
   // std::reverse does not work out of the box on SetVector and I want an
   // in-place swap based thing (the real std::reverse, not the LLVM adapter).
-  SmallVector<Operation *, 0> v(forwardSlice->takeVector());
+  std::vector<Operation *> v(forwardSlice->takeVector());
   forwardSlice->insert(v.rbegin(), v.rend());
 }
 
@@ -74,7 +74,7 @@ void mlir::getForwardSlice(Value root, SetVector<Operation *> *forwardSlice,
   // Reverse to get back the actual topological order.
   // std::reverse does not work out of the box on SetVector and I want an
   // in-place swap based thing (the real std::reverse, not the LLVM adapter).
-  SmallVector<Operation *, 0> v(forwardSlice->takeVector());
+  std::vector<Operation *> v(forwardSlice->takeVector());
   forwardSlice->insert(v.rbegin(), v.rend());
 }
 


        


More information about the cfe-commits mailing list