diff --git a/clang/include/clang/AST/CXXInheritance.h b/clang/include/clang/AST/CXXInheritance.h index bbef01843e0b0..b9057e15a4198 100644 --- a/clang/include/clang/AST/CXXInheritance.h +++ b/clang/include/clang/AST/CXXInheritance.h @@ -268,7 +268,7 @@ struct UniqueVirtualMethod { /// subobject in which that virtual function occurs). class OverridingMethods { using ValuesT = SmallVector; - using MapType = llvm::MapVector; + using MapType = llvm::SmallMapVector; MapType Overrides; diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index 777cdca1a0c0d..0ec0855cf5244 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -392,8 +392,8 @@ class CXXNameMangler { AbiTagState *AbiTags = nullptr; AbiTagState AbiTagsRoot; - llvm::DenseMap Substitutions; - llvm::DenseMap ModuleSubstitutions; + llvm::SmallDenseMap Substitutions; + llvm::SmallDenseMap ModuleSubstitutions; ASTContext &getASTContext() const { return Context.getASTContext(); } diff --git a/llvm/include/llvm/ADT/SCCIterator.h b/llvm/include/llvm/ADT/SCCIterator.h index 3bd103c13f19f..a35e0a3f8e8c9 100644 --- a/llvm/include/llvm/ADT/SCCIterator.h +++ b/llvm/include/llvm/ADT/SCCIterator.h @@ -73,7 +73,7 @@ class scc_iterator : public iterator_facade_base< /// /// nodeVisitNumbers are per-node visit numbers, also used as DFS flags. unsigned visitNum; - DenseMap nodeVisitNumbers; + SmallDenseMap nodeVisitNumbers; /// Stack holding nodes of the SCC. std::vector SCCNodeStack; diff --git a/llvm/include/llvm/Analysis/ConstraintSystem.h b/llvm/include/llvm/Analysis/ConstraintSystem.h index 449852343964c..2ac0fc1ddc06c 100644 --- a/llvm/include/llvm/Analysis/ConstraintSystem.h +++ b/llvm/include/llvm/Analysis/ConstraintSystem.h @@ -51,7 +51,7 @@ class ConstraintSystem { /// A map of variables (IR values) to their corresponding index in the /// constraint system. - DenseMap Value2Index; + SmallDenseMap Value2Index; // Eliminate constraints from the system using Fourier–Motzkin elimination. bool eliminateUsingFM(); @@ -70,7 +70,7 @@ class ConstraintSystem { Value2Index.insert({Arg, Value2Index.size() + 1}); } } - ConstraintSystem(const DenseMap &Value2Index) + ConstraintSystem(const SmallDenseMap &Value2Index) : NumVariables(Value2Index.size()), Value2Index(Value2Index) {} bool addVariableRow(ArrayRef R) { @@ -92,8 +92,8 @@ class ConstraintSystem { return true; } - DenseMap &getValue2Index() { return Value2Index; } - const DenseMap &getValue2Index() const { + SmallDenseMap &getValue2Index() { return Value2Index; } + const SmallDenseMap &getValue2Index() const { return Value2Index; } diff --git a/llvm/include/llvm/Analysis/DominanceFrontier.h b/llvm/include/llvm/Analysis/DominanceFrontier.h index 68ddcf753b59f..394379d975082 100644 --- a/llvm/include/llvm/Analysis/DominanceFrontier.h +++ b/llvm/include/llvm/Analysis/DominanceFrontier.h @@ -41,8 +41,8 @@ class DominanceFrontierBase { public: // Dom set for a bb. Use SetVector to make iterating dom frontiers of a bb // deterministic. - using DomSetType = SetVector; - using DomSetMapType = DenseMap; // Dom set map + using DomSetType = SmallSetVector; + using DomSetMapType = SmallDenseMap; // Dom set map protected: using BlockTraits = GraphTraits; diff --git a/llvm/include/llvm/Analysis/DominanceFrontierImpl.h b/llvm/include/llvm/Analysis/DominanceFrontierImpl.h index e877b2c4749ab..165e137a5ecfc 100644 --- a/llvm/include/llvm/Analysis/DominanceFrontierImpl.h +++ b/llvm/include/llvm/Analysis/DominanceFrontierImpl.h @@ -55,7 +55,7 @@ void DominanceFrontierBase::print(raw_ostream &OS) const { OS << " <>"; OS << " is:\t"; - const SetVector &BBs = I->second; + const SmallSetVector &BBs = I->second; for (const BlockT *BB : BBs) { OS << ' '; diff --git a/llvm/include/llvm/Analysis/LoopIterator.h b/llvm/include/llvm/Analysis/LoopIterator.h index 523d2a21825d0..aaca0298d21da 100644 --- a/llvm/include/llvm/Analysis/LoopIterator.h +++ b/llvm/include/llvm/Analysis/LoopIterator.h @@ -97,8 +97,8 @@ struct LoopBodyTraits { class LoopBlocksDFS { public: /// Postorder list iterators. - typedef std::vector::const_iterator POIterator; - typedef std::vector::const_reverse_iterator RPOIterator; + typedef SmallVector::const_iterator POIterator; + typedef SmallVector::const_reverse_iterator RPOIterator; friend class LoopBlocksTraversal; @@ -108,8 +108,8 @@ class LoopBlocksDFS { /// Map each block to its postorder number. A block is only mapped after it is /// preorder visited by DFS. It's postorder number is initially zero and set /// to nonzero after it is finished by postorder traversal. - DenseMap PostNumbers; - std::vector PostBlocks; + SmallDenseMap PostNumbers; + SmallVector PostBlocks; public: LoopBlocksDFS(Loop *Container) : diff --git a/llvm/include/llvm/Analysis/MemorySSA.h b/llvm/include/llvm/Analysis/MemorySSA.h index 09fc34af60dc3..1ceabfa1b13cf 100644 --- a/llvm/include/llvm/Analysis/MemorySSA.h +++ b/llvm/include/llvm/Analysis/MemorySSA.h @@ -879,7 +879,7 @@ class MemorySSA { Loop *L = nullptr; // Memory SSA mappings - DenseMap ValueToMemoryAccess; + SmallDenseMap ValueToMemoryAccess; // These two mappings contain the main block to access/def mappings for // MemorySSA. The list contained in PerBlockAccesses really owns all the @@ -895,7 +895,7 @@ class MemorySSA { // Note that the numbering is local to a block, even though the map is // global. mutable SmallPtrSet BlockNumberingValid; - mutable DenseMap BlockNumbering; + mutable SmallDenseMap BlockNumbering; // Memory SSA building info std::unique_ptr WalkerBase; diff --git a/llvm/include/llvm/Analysis/MustExecute.h b/llvm/include/llvm/Analysis/MustExecute.h index 8ac3c5eb653cd..e49b6facf76b5 100644 --- a/llvm/include/llvm/Analysis/MustExecute.h +++ b/llvm/include/llvm/Analysis/MustExecute.h @@ -58,7 +58,7 @@ class raw_ostream; /// methods except for computeLoopSafetyInfo is undefined. class LoopSafetyInfo { // Used to update funclet bundle operands. - DenseMap BlockColors; + BlockColorMapT BlockColors; protected: /// Computes block colors. @@ -66,7 +66,7 @@ class LoopSafetyInfo { public: /// Returns block colors map that is used to update funclet operand bundles. - const DenseMap &getBlockColors() const; + const BlockColorMapT &getBlockColors() const; /// Copy colors of block \p Old into the block \p New. void copyColors(BasicBlock *New, BasicBlock *Old); diff --git a/llvm/include/llvm/IR/EHPersonalities.h b/llvm/include/llvm/IR/EHPersonalities.h index c70f832de40b4..2dcb7511ba4df 100644 --- a/llvm/include/llvm/IR/EHPersonalities.h +++ b/llvm/include/llvm/IR/EHPersonalities.h @@ -107,12 +107,13 @@ inline bool isNoOpWithoutInvoke(EHPersonality Pers) { bool canSimplifyInvokeNoUnwind(const Function *F); typedef TinyPtrVector ColorVector; +typedef SmallDenseMap BlockColorMapT; /// If an EH funclet personality is in use (see isFuncletEHPersonality), /// this will recompute which blocks are in which funclet. It is possible that /// some blocks are in multiple funclets. Consider this analysis to be /// expensive. -DenseMap colorEHFunclets(Function &F); +BlockColorMapT colorEHFunclets(Function &F); } // end namespace llvm diff --git a/llvm/include/llvm/IR/PredIteratorCache.h b/llvm/include/llvm/IR/PredIteratorCache.h index ba3228347076b..055ab91a52266 100644 --- a/llvm/include/llvm/IR/PredIteratorCache.h +++ b/llvm/include/llvm/IR/PredIteratorCache.h @@ -26,7 +26,7 @@ namespace llvm { /// wants the predecessor list for the same blocks. class PredIteratorCache { /// Cached list of predecessors, allocated in Memory. - DenseMap> BlockToPredsMap; + SmallDenseMap, 16> BlockToPredsMap; /// Memory - This is the space that holds cached preds. BumpPtrAllocator Memory; diff --git a/llvm/include/llvm/Transforms/Utils/Cloning.h b/llvm/include/llvm/Transforms/Utils/Cloning.h index a4be24e32c527..3f27cc0cf449d 100644 --- a/llvm/include/llvm/Transforms/Utils/Cloning.h +++ b/llvm/include/llvm/Transforms/Utils/Cloning.h @@ -81,7 +81,7 @@ struct ClonedCodeInfo { /// Like VMap, but maps only unsimplified instructions. Values in the map /// may be dangling, it is only intended to be used via isSimplified(), to /// check whether the main VMap mapping involves simplification or not. - DenseMap OrigVMap; + SmallDenseMap OrigVMap; ClonedCodeInfo() = default; diff --git a/llvm/include/llvm/Transforms/Utils/SSAUpdaterImpl.h b/llvm/include/llvm/Transforms/Utils/SSAUpdaterImpl.h index 746926e5bee33..089a7d05ca094 100644 --- a/llvm/include/llvm/Transforms/Utils/SSAUpdaterImpl.h +++ b/llvm/include/llvm/Transforms/Utils/SSAUpdaterImpl.h @@ -70,7 +70,7 @@ class SSAUpdaterImpl { : BB(ThisBB), AvailableVal(V), DefBB(V ? this : nullptr) {} }; - using AvailableValsTy = DenseMap; + using AvailableValsTy = SmallDenseMap; AvailableValsTy *AvailableVals; diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp index d2c329ba748e5..3ad137382cd5f 100644 --- a/llvm/lib/Analysis/InlineCost.cpp +++ b/llvm/lib/Analysis/InlineCost.cpp @@ -608,7 +608,7 @@ class InlineCostCallAnalyzer final : public CallAnalyzer { /// The mapping of caller Alloca values to their accumulated cost savings. If /// we have to disable SROA for one of the allocas, this tells us how much /// cost must be added. - DenseMap SROAArgCosts; + SmallDenseMap SROAArgCosts; /// Return true if \p Call is a cold callsite. bool isColdCallSite(CallBase &Call, BlockFrequencyInfo *CallerBFI); diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp index 30dc4ae30dbfa..d7e663d60d8dc 100644 --- a/llvm/lib/Analysis/LazyValueInfo.cpp +++ b/llvm/lib/Analysis/LazyValueInfo.cpp @@ -322,7 +322,7 @@ class LazyValueInfoImpl { SmallVector, 8> BlockValueStack; /// Keeps track of which block-value pairs are in BlockValueStack. - DenseSet > BlockValueSet; + SmallDenseSet, 16> BlockValueSet; /// Push BV onto BlockValueStack unless it's already in there. /// Returns true on success. diff --git a/llvm/lib/Analysis/MustExecute.cpp b/llvm/lib/Analysis/MustExecute.cpp index caed62679a683..52d631b56beb7 100644 --- a/llvm/lib/Analysis/MustExecute.cpp +++ b/llvm/lib/Analysis/MustExecute.cpp @@ -28,7 +28,7 @@ using namespace llvm; #define DEBUG_TYPE "must-execute" -const DenseMap & +const BlockColorMapT & LoopSafetyInfo::getBlockColors() const { return BlockColors; } diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp index a9d28a39c4418..2b65d2ed45b51 100644 --- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp +++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp @@ -4151,7 +4151,7 @@ std::optional InstrRefBasedLDV::resolveDbgPHIsImpl( // Adapted LLVM SSA Updater: LDVSSAUpdater Updater(Loc, MLiveIns); // Map of which Def or PHI is the current value in each block. - DenseMap AvailableValues; + SmallDenseMap AvailableValues; // Set of PHIs that we have created along the way. SmallVector CreatedPHIs; diff --git a/llvm/lib/CodeGen/MachineSSAUpdater.cpp b/llvm/lib/CodeGen/MachineSSAUpdater.cpp index 4cbb6ad3128bd..186f729859092 100644 --- a/llvm/lib/CodeGen/MachineSSAUpdater.cpp +++ b/llvm/lib/CodeGen/MachineSSAUpdater.cpp @@ -34,7 +34,7 @@ using namespace llvm; #define DEBUG_TYPE "machine-ssaupdater" -using AvailableValsTy = DenseMap; +using AvailableValsTy = SmallDenseMap; static AvailableValsTy &getAvailableVals(void *AV) { return *static_cast(AV); diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp index c58c67b70fe3c..07057d4fe6937 100644 --- a/llvm/lib/CodeGen/WinEHPrepare.cpp +++ b/llvm/lib/CodeGen/WinEHPrepare.cpp @@ -90,7 +90,7 @@ class WinEHPrepareImpl { EHPersonality Personality = EHPersonality::Unknown; const DataLayout *DL = nullptr; - DenseMap BlockColors; + BlockColorMapT BlockColors; MapVector> FuncletBlocks; }; @@ -189,7 +189,7 @@ static BasicBlock *getCleanupRetUnwindDest(const CleanupPadInst *CleanupPad) { static void calculateStateNumbersForInvokes(const Function *Fn, WinEHFuncInfo &FuncInfo) { auto *F = const_cast(Fn); - DenseMap BlockColors = colorEHFunclets(*F); + BlockColorMapT BlockColors = colorEHFunclets(*F); for (BasicBlock &BB : *F) { auto *II = dyn_cast(BB.getTerminator()); if (!II) diff --git a/llvm/lib/IR/EHPersonalities.cpp b/llvm/lib/IR/EHPersonalities.cpp index 7c32601b8a83e..08cbd92cc38ba 100644 --- a/llvm/lib/IR/EHPersonalities.cpp +++ b/llvm/lib/IR/EHPersonalities.cpp @@ -102,10 +102,10 @@ bool llvm::canSimplifyInvokeNoUnwind(const Function *F) { return !EHa && !isAsynchronousEHPersonality(Personality); } -DenseMap llvm::colorEHFunclets(Function &F) { +BlockColorMapT llvm::colorEHFunclets(Function &F) { SmallVector, 16> Worklist; BasicBlock *EntryBlock = &F.getEntryBlock(); - DenseMap BlockColors; + BlockColorMapT BlockColors; // Build up the color map, which maps each block to its set of 'colors'. // For any block B the "colors" of B are the set of funclets F (possibly diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index b89c9ce46e7d6..2d594945ca839 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -363,7 +363,7 @@ class Verifier : public InstVisitor, VerifierSupport { /// Cache which blocks are in which funclet, if an EH funclet personality is /// in use. Otherwise empty. - DenseMap BlockEHFuncletColors; + BlockColorMapT BlockEHFuncletColors; /// Cache of constants visited in search of ConstantExprs. SmallPtrSet ConstantExprVisited; diff --git a/llvm/lib/Target/X86/X86WinEHState.cpp b/llvm/lib/Target/X86/X86WinEHState.cpp index 963d613ddbfe7..199f8438c61e8 100644 --- a/llvm/lib/Target/X86/X86WinEHState.cpp +++ b/llvm/lib/Target/X86/X86WinEHState.cpp @@ -70,9 +70,9 @@ class WinEHStatePass : public FunctionPass { bool isStateStoreNeeded(EHPersonality Personality, CallBase &Call); void rewriteSetJmpCall(IRBuilder<> &Builder, Function &F, CallBase &Call, Value *State); - int getBaseStateForBB(DenseMap &BlockColors, + int getBaseStateForBB(BlockColorMapT &BlockColors, WinEHFuncInfo &FuncInfo, BasicBlock *BB); - int getStateForCall(DenseMap &BlockColors, + int getStateForCall(BlockColorMapT &BlockColors, WinEHFuncInfo &FuncInfo, CallBase &Call); // Module-level type getters. @@ -501,7 +501,7 @@ void WinEHStatePass::rewriteSetJmpCall(IRBuilder<> &Builder, Function &F, // Figure out what state we should assign calls in this block. int WinEHStatePass::getBaseStateForBB( - DenseMap &BlockColors, WinEHFuncInfo &FuncInfo, + BlockColorMapT &BlockColors, WinEHFuncInfo &FuncInfo, BasicBlock *BB) { int BaseState = ParentBaseState; auto &BBColors = BlockColors[BB]; @@ -520,7 +520,7 @@ int WinEHStatePass::getBaseStateForBB( // Calculate the state a call-site is in. int WinEHStatePass::getStateForCall( - DenseMap &BlockColors, WinEHFuncInfo &FuncInfo, + BlockColorMapT &BlockColors, WinEHFuncInfo &FuncInfo, CallBase &Call) { if (auto *II = dyn_cast(&Call)) { // Look up the state number of the EH pad this unwinds to. @@ -644,7 +644,7 @@ void WinEHStatePass::addStateStores(Function &F, WinEHFuncInfo &FuncInfo) { calculateWinCXXEHStateNumbers(&F, FuncInfo); // Iterate all the instructions and emit state number stores. - DenseMap BlockColors = colorEHFunclets(F); + BlockColorMapT BlockColors = colorEHFunclets(F); ReversePostOrderTraversal RPOT(&F); // InitialStates yields the state of the first call-site for a BasicBlock. diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index 1f4a6f793404c..fbd11292115c2 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -5307,7 +5307,7 @@ bool InstCombinerImpl::prepareWorklist(Function &F) { bool MadeIRChange = false; SmallPtrSet LiveBlocks; SmallVector InstrsForInstructionWorklist; - DenseMap FoldedConstants; + SmallDenseMap FoldedConstants; AliasScopeTracker SeenAliasScopes; auto HandleOnlyLiveSuccessor = [&](BasicBlock *BB, BasicBlock *LiveSucc) { diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 2ad89b5ba753a..4665304632c9b 100644 --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -669,7 +669,7 @@ class RuntimeCallInserter { return; assert(TrackInsertedCalls && "Calls were wrongly tracked"); - DenseMap BlockColors = colorEHFunclets(*OwnerFn); + BlockColorMapT BlockColors = colorEHFunclets(*OwnerFn); for (CallInst *CI : InsertedCalls) { BasicBlock *BB = CI->getParent(); assert(BB && "Instruction doesn't belong to a BasicBlock"); diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp index 10442fa0bb900..164ffbec26421 100644 --- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp +++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp @@ -864,7 +864,7 @@ BasicBlock *FuncPGOInstrumentation::getInstrBB(Edge *E) { // value profiling call for the value profile candidate call. static void populateEHOperandBundle(VPCandidateInfo &Cand, - DenseMap &BlockColors, + BlockColorMapT &BlockColors, SmallVectorImpl &OpBundles) { auto *OrigCall = dyn_cast(Cand.AnnotatedInst); if (!OrigCall) @@ -1006,7 +1006,7 @@ void FunctionInstrumenter::instrument() { // Windows exception handling attached to them. However, if value profiling is // inserted for one of these calls, then a funclet value will need to be set // on the instrumentation call based on the funclet coloring. - DenseMap BlockColors; + BlockColorMapT BlockColors; if (F.hasPersonalityFn() && isScopedEHPersonality(classifyEHPersonality(F.getPersonalityFn()))) BlockColors = colorEHFunclets(F); diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARC.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARC.cpp index 33870d7ea192a..4745bb9bbcbb7 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARC.cpp +++ b/llvm/lib/Transforms/ObjCARC/ObjCARC.cpp @@ -24,7 +24,7 @@ using namespace llvm::objcarc; CallInst *objcarc::createCallInstWithColors( FunctionCallee Func, ArrayRef Args, const Twine &NameStr, BasicBlock::iterator InsertBefore, - const DenseMap &BlockColors) { + const BlockColorMapT &BlockColors) { FunctionType *FTy = Func.getFunctionType(); Value *Callee = Func.getCallee(); SmallVector OpBundles; @@ -73,13 +73,13 @@ BundledRetainClaimRVs::insertAfterInvokes(Function &F, DominatorTree *DT) { CallInst *BundledRetainClaimRVs::insertRVCall(BasicBlock::iterator InsertPt, CallBase *AnnotatedCall) { - DenseMap BlockColors; + BlockColorMapT BlockColors; return insertRVCallWithColors(InsertPt, AnnotatedCall, BlockColors); } CallInst *BundledRetainClaimRVs::insertRVCallWithColors( BasicBlock::iterator InsertPt, CallBase *AnnotatedCall, - const DenseMap &BlockColors) { + const BlockColorMapT &BlockColors) { IRBuilder<> Builder(InsertPt->getParent(), InsertPt); Function *Func = *objcarc::getAttachedARCFunction(AnnotatedCall); assert(Func && "operand isn't a Function"); diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARC.h b/llvm/lib/Transforms/ObjCARC/ObjCARC.h index f4d7c92d499c1..fe08aec6d4c17 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARC.h +++ b/llvm/lib/Transforms/ObjCARC/ObjCARC.h @@ -100,7 +100,7 @@ static inline MDString *getRVInstMarker(Module &M) { CallInst *createCallInstWithColors( FunctionCallee Func, ArrayRef Args, const Twine &NameStr, BasicBlock::iterator InsertBefore, - const DenseMap &BlockColors); + const BlockColorMapT &BlockColors); class BundledRetainClaimRVs { public: @@ -119,7 +119,7 @@ class BundledRetainClaimRVs { /// Insert a retainRV/claimRV call with colors. CallInst *insertRVCallWithColors( BasicBlock::iterator InsertPt, CallBase *AnnotatedCall, - const DenseMap &BlockColors); + const BlockColorMapT &BlockColors); /// See if an instruction is a bundled retainRV/claimRV call. bool contains(const Instruction *I) const { diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp index 2c8b4e76312a0..60ba0a8752d84 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp +++ b/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp @@ -88,7 +88,7 @@ class ObjCARCContract { bool tryToPeepholeInstruction( Function &F, Instruction *Inst, inst_iterator &Iter, bool &TailOkForStoreStrong, - const DenseMap &BlockColors); + const BlockColorMapT &BlockColors); bool optimizeRetainCall(Function &F, Instruction *Retain); @@ -97,7 +97,7 @@ class ObjCARCContract { void tryToContractReleaseIntoStoreStrong( Instruction *Release, inst_iterator &Iter, - const DenseMap &BlockColors); + const BlockColorMapT &BlockColors); public: bool init(Module &M); @@ -338,7 +338,7 @@ findRetainForStoreStrongContraction(Value *New, StoreInst *Store, /// safe. void ObjCARCContract::tryToContractReleaseIntoStoreStrong( Instruction *Release, inst_iterator &Iter, - const DenseMap &BlockColors) { + const BlockColorMapT &BlockColors) { // See if we are releasing something that we just loaded. auto *Load = dyn_cast(GetArgRCIdentityRoot(Release)); if (!Load || !Load->isSimple()) @@ -415,7 +415,7 @@ void ObjCARCContract::tryToContractReleaseIntoStoreStrong( bool ObjCARCContract::tryToPeepholeInstruction( Function &F, Instruction *Inst, inst_iterator &Iter, bool &TailOkForStoreStrongs, - const DenseMap &BlockColors) { + const BlockColorMapT &BlockColors) { // Only these library routines return their argument. In particular, // objc_retainBlock does not necessarily return its argument. ARCInstKind Class = GetBasicARCInstKind(Inst); @@ -561,7 +561,7 @@ bool ObjCARCContract::run(Function &F, AAResults *A, DominatorTree *D) { Changed |= R.first; CFGChanged |= R.second; - DenseMap BlockColors; + BlockColorMapT BlockColors; if (F.hasPersonalityFn() && isScopedEHPersonality(classifyEHPersonality(F.getPersonalityFn()))) BlockColors = colorEHFunclets(F); diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp index a2434675a7b5a..d15753e87abab 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp +++ b/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp @@ -501,7 +501,7 @@ class ObjCARCOpt { /// is in fact used in the current function. unsigned UsedInThisFunction; - DenseMap BlockEHColors; + BlockColorMapT BlockEHColors; bool OptimizeRetainRVCall(Function &F, Instruction *RetainRV); void OptimizeAutoreleaseRVCall(Function &F, Instruction *AutoreleaseRV, diff --git a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp index 7c06e0c757e1c..452750ba5ae25 100644 --- a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp +++ b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp @@ -285,10 +285,10 @@ class ConstraintInfo { } } - DenseMap &getValue2Index(bool Signed) { + SmallDenseMap &getValue2Index(bool Signed) { return Signed ? SignedCS.getValue2Index() : UnsignedCS.getValue2Index(); } - const DenseMap &getValue2Index(bool Signed) const { + const SmallDenseMap &getValue2Index(bool Signed) const { return Signed ? SignedCS.getValue2Index() : UnsignedCS.getValue2Index(); } @@ -893,7 +893,7 @@ void ConstraintInfo::transferToOtherSystem( #ifndef NDEBUG static void dumpConstraint(ArrayRef C, - const DenseMap &Value2Index) { + const SmallDenseMap &Value2Index) { ConstraintSystem CS(Value2Index); CS.addVariableRowFill(C); CS.dump(); diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp index e742d2ed12af1..98343b688ae24 100644 --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp @@ -417,7 +417,7 @@ static bool LinearizeExprTree(Instruction *I, // Leaves - Keeps track of the set of putative leaves as well as the number of // paths to each leaf seen so far. - using LeafMap = DenseMap; + using LeafMap = SmallDenseMap; LeafMap Leaves; // Leaf -> Total weight so far. SmallVector LeafOrder; // Ensure deterministic leaf output order. const DataLayout DL = I->getDataLayout(); diff --git a/llvm/lib/Transforms/Utils/SSAUpdater.cpp b/llvm/lib/Transforms/Utils/SSAUpdater.cpp index 7fd3e51e141f3..d8b274491773b 100644 --- a/llvm/lib/Transforms/Utils/SSAUpdater.cpp +++ b/llvm/lib/Transforms/Utils/SSAUpdater.cpp @@ -37,7 +37,7 @@ using namespace llvm; #define DEBUG_TYPE "ssaupdater" -using AvailableValsTy = DenseMap; +using AvailableValsTy = SmallDenseMap; static AvailableValsTy &getAvailableVals(void *AV) { return *static_cast(AV);