diff options
author | Matthias Braun <matze@braunis.de> | 2016-01-30 01:24:31 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2016-01-30 01:24:31 +0000 |
commit | b30f2f51410449a6d476fed5c486a4ef8fd5f912 (patch) | |
tree | af58fd7a768c6b601eaf890020aa3e2b4a3130b6 /llvm/lib | |
parent | daa812d518b1f49feddeb08fcc9c5e563b0bf11e (diff) | |
download | bcm5719-llvm-b30f2f51410449a6d476fed5c486a4ef8fd5f912.tar.gz bcm5719-llvm-b30f2f51410449a6d476fed5c486a4ef8fd5f912.zip |
Avoid overly large SmallPtrSet/SmallSet
These sets perform linear searching in small mode so it is never a good
idea to use SmallSize/N bigger than 32.
llvm-svn: 259283
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Analysis/CFG.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Analysis/GlobalsModRef.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Analysis/MemoryDependenceAnalysis.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SjLjEHPrepare.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Support/CommandLine.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Target/ARM/ARMISelLowering.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/IPO/MergeFunctions.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/IPO/SampleProfile.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstructionCombining.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/ADCE.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/SplitModule.cpp | 2 |
18 files changed, 20 insertions, 20 deletions
diff --git a/llvm/lib/Analysis/CFG.cpp b/llvm/lib/Analysis/CFG.cpp index 0dfd57d3cb6..a319be8092f 100644 --- a/llvm/lib/Analysis/CFG.cpp +++ b/llvm/lib/Analysis/CFG.cpp @@ -138,7 +138,7 @@ bool llvm::isPotentiallyReachableFromMany( // Limit the number of blocks we visit. The goal is to avoid run-away compile // times on large CFGs without hampering sensible code. Arbitrarily chosen. unsigned Limit = 32; - SmallSet<const BasicBlock*, 64> Visited; + SmallPtrSet<const BasicBlock*, 32> Visited; do { BasicBlock *BB = Worklist.pop_back_val(); if (!Visited.insert(BB).second) diff --git a/llvm/lib/Analysis/GlobalsModRef.cpp b/llvm/lib/Analysis/GlobalsModRef.cpp index db3d5f781d8..8338dcc9c1d 100644 --- a/llvm/lib/Analysis/GlobalsModRef.cpp +++ b/llvm/lib/Analysis/GlobalsModRef.cpp @@ -269,7 +269,7 @@ GlobalsAAResult::getFunctionInfo(const Function *F) { /// (really, their address passed to something nontrivial), record this fact, /// and record the functions that they are used directly in. void GlobalsAAResult::AnalyzeGlobals(Module &M) { - SmallPtrSet<Function *, 64> TrackedFunctions; + SmallPtrSet<Function *, 32> TrackedFunctions; for (Function &F : M) if (F.hasLocalLinkage()) if (!AnalyzeUsesOfPointer(&F)) { @@ -281,7 +281,7 @@ void GlobalsAAResult::AnalyzeGlobals(Module &M) { ++NumNonAddrTakenFunctions; } - SmallPtrSet<Function *, 64> Readers, Writers; + SmallPtrSet<Function *, 16> Readers, Writers; for (GlobalVariable &GV : M.globals()) if (GV.hasLocalLinkage()) { if (!AnalyzeUsesOfPointer(&GV, &Readers, diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp index 6918360536a..9492801bba2 100644 --- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -854,7 +854,7 @@ MemoryDependenceAnalysis::getNonLocalCallDependency(CallSite QueryCS) { // isReadonlyCall - If this is a read-only call, we can be more aggressive. bool isReadonlyCall = AA->onlyReadsMemory(QueryCS); - SmallPtrSet<BasicBlock*, 64> Visited; + SmallPtrSet<BasicBlock*, 32> Visited; unsigned NumSortedEntries = Cache.size(); DEBUG(AssertSorted(Cache)); diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index fea77d0f216..6323a4b406f 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -112,7 +112,7 @@ namespace { /// /// This is used to allow us to reliably add any operands of a DAG node /// which have not yet been combined to the worklist. - SmallPtrSet<SDNode *, 64> CombinedNodes; + SmallPtrSet<SDNode *, 32> CombinedNodes; // AA - Used for DAG load/store alias analysis. AliasAnalysis &AA; diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp index 2a6c853a1d1..c71163c65da 100644 --- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp @@ -321,7 +321,7 @@ void ScheduleDAGSDNodes::BuildSchedUnits() { // Add all nodes in depth first order. SmallVector<SDNode*, 64> Worklist; - SmallPtrSet<SDNode*, 64> Visited; + SmallPtrSet<SDNode*, 32> Visited; Worklist.push_back(DAG->getRoot().getNode()); Visited.insert(DAG->getRoot().getNode()); diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp index 6555cccdbea..69612ed5aae 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp @@ -630,7 +630,7 @@ static bool printOperand(raw_ostream &OS, const SelectionDAG *G, } } -typedef SmallPtrSet<const SDNode *, 128> VisitedSDNodeSet; +typedef SmallPtrSet<const SDNode *, 32> VisitedSDNodeSet; static void DumpNodesr(raw_ostream &OS, const SDNode *N, unsigned indent, const SelectionDAG *G, VisitedSDNodeSet &once) { if (!once.insert(N).second) // If we've been here before, return now. diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 82397200e0d..952018e4e2f 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -669,7 +669,7 @@ void SelectionDAGISel::SelectBasicBlock(BasicBlock::const_iterator Begin, } void SelectionDAGISel::ComputeLiveOutVRegInfo() { - SmallPtrSet<SDNode*, 128> VisitedNodes; + SmallPtrSet<SDNode*, 16> VisitedNodes; SmallVector<SDNode*, 128> Worklist; Worklist.push_back(CurDAG->getRoot().getNode()); diff --git a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp index 02545a73065..edd0ca47c38 100644 --- a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp @@ -258,7 +258,7 @@ static void removeDuplicatesGCPtrs(SmallVectorImpl<const Value *> &Bases, SelectionDAGBuilder &Builder) { // This is horribly inefficient, but I don't care right now - SmallSet<SDValue, 64> Seen; + SmallSet<SDValue, 32> Seen; SmallVector<const Value *, 64> NewBases, NewPtrs, NewRelocs; for (size_t i = 0; i < Ptrs.size(); i++) { diff --git a/llvm/lib/CodeGen/SjLjEHPrepare.cpp b/llvm/lib/CodeGen/SjLjEHPrepare.cpp index e1f242a08de..144366185dc 100644 --- a/llvm/lib/CodeGen/SjLjEHPrepare.cpp +++ b/llvm/lib/CodeGen/SjLjEHPrepare.cpp @@ -303,7 +303,7 @@ void SjLjEHPrepare::lowerAcrossUnwindEdges(Function &F, } // Find all of the blocks that this value is live in. - SmallPtrSet<BasicBlock *, 64> LiveBBs; + SmallPtrSet<BasicBlock *, 32> LiveBBs; LiveBBs.insert(Inst->getParent()); while (!Users.empty()) { Instruction *U = Users.back(); diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index fdcdb03706d..c1615a0a683 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -1449,7 +1449,7 @@ static int OptNameCompare(const std::pair<const char *, Option *> *LHS, static void sortOpts(StringMap<Option *> &OptMap, SmallVectorImpl<std::pair<const char *, Option *>> &Opts, bool ShowHidden) { - SmallPtrSet<Option *, 128> OptionSet; // Duplicate option detection. + SmallPtrSet<Option *, 32> OptionSet; // Duplicate option detection. for (StringMap<Option *>::iterator I = OptMap.begin(), E = OptMap.end(); I != E; ++I) { diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index 7d1684a5525..0a58e6e5af4 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -7184,7 +7184,7 @@ void ARMTargetLowering::EmitSjLjDispatchBlock(MachineInstr *MI, // Get an ordered list of the machine basic blocks for the jump table. std::vector<MachineBasicBlock*> LPadList; - SmallPtrSet<MachineBasicBlock*, 64> InvokeBBs; + SmallPtrSet<MachineBasicBlock*, 32> InvokeBBs; LPadList.reserve(CallSiteNumToLPad.size()); for (unsigned I = 1; I <= MaxCSNum; ++I) { SmallVectorImpl<MachineBasicBlock*> &MBBList = CallSiteNumToLPad[I]; diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp index 8a209a18c54..702aaa9c62a 100644 --- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp +++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp @@ -1249,7 +1249,7 @@ int FunctionComparator::compare() { // functions, then takes each block from each terminator in order. As an // artifact, this also means that unreachable blocks are ignored. SmallVector<const BasicBlock *, 8> FnLBBs, FnRBBs; - SmallSet<const BasicBlock *, 128> VisitedBBs; // in terms of F1. + SmallPtrSet<const BasicBlock *, 32> VisitedBBs; // in terms of F1. FnLBBs.push_back(&FnL->getEntryBlock()); FnRBBs.push_back(&FnR->getEntryBlock()); diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp index 928d92ef9d1..191f85e8b58 100644 --- a/llvm/lib/Transforms/IPO/SampleProfile.cpp +++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp @@ -163,10 +163,10 @@ protected: EdgeWeightMap EdgeWeights; /// \brief Set of visited blocks during propagation. - SmallPtrSet<const BasicBlock *, 128> VisitedBlocks; + SmallPtrSet<const BasicBlock *, 32> VisitedBlocks; /// \brief Set of visited edges during propagation. - SmallSet<Edge, 128> VisitedEdges; + SmallSet<Edge, 32> VisitedEdges; /// \brief Equivalence classes for block weights. /// diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index 329a1f1af89..e713f902465 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -3001,7 +3001,7 @@ static bool prepareICWorklistFromFunction(Function &F, const DataLayout &DL, // Do a depth-first traversal of the function, populate the worklist with // the reachable instructions. Ignore blocks that are not reachable. Keep // track of which blocks we visit. - SmallPtrSet<BasicBlock *, 64> Visited; + SmallPtrSet<BasicBlock *, 32> Visited; MadeIRChange |= AddReachableCodeToWorklist(&F.front(), DL, Visited, ICWorklist, TLI); diff --git a/llvm/lib/Transforms/Scalar/ADCE.cpp b/llvm/lib/Transforms/Scalar/ADCE.cpp index 590a52da6b1..f3ad9556080 100644 --- a/llvm/lib/Transforms/Scalar/ADCE.cpp +++ b/llvm/lib/Transforms/Scalar/ADCE.cpp @@ -34,7 +34,7 @@ using namespace llvm; STATISTIC(NumRemoved, "Number of instructions removed"); static bool aggressiveDCE(Function& F) { - SmallPtrSet<Instruction*, 128> Alive; + SmallPtrSet<Instruction*, 32> Alive; SmallVector<Instruction*, 128> Worklist; // Collect the set of "root" instructions that are known live. diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp index b33b3b60031..ef291e7db2f 100644 --- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp @@ -2718,7 +2718,7 @@ static void checkBasicSSA(DominatorTree &DT, GCPtrLivenessData &Data, static void computeLiveInValues(DominatorTree &DT, Function &F, GCPtrLivenessData &Data) { - SmallSetVector<BasicBlock *, 200> Worklist; + SmallSetVector<BasicBlock *, 32> Worklist; auto AddPredsToWorklist = [&](BasicBlock *BB) { // We use a SetVector so that we don't have duplicates in the worklist. Worklist.insert(pred_begin(BB), pred_end(BB)); diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index fd9c7f6f886..b5eba29dcf2 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1465,7 +1465,7 @@ void llvm::removeUnwindEdge(BasicBlock *BB) { /// if they are in a dead cycle. Return true if a change was made, false /// otherwise. bool llvm::removeUnreachableBlocks(Function &F, LazyValueInfo *LVI) { - SmallPtrSet<BasicBlock*, 128> Reachable; + SmallPtrSet<BasicBlock*, 16> Reachable; bool Changed = markAliveBlocks(F, Reachable); // If there are unreachable blocks in the CFG... diff --git a/llvm/lib/Transforms/Utils/SplitModule.cpp b/llvm/lib/Transforms/Utils/SplitModule.cpp index dcb2307bfa9..993d3e58db4 100644 --- a/llvm/lib/Transforms/Utils/SplitModule.cpp +++ b/llvm/lib/Transforms/Utils/SplitModule.cpp @@ -138,7 +138,7 @@ static void findPartitions(Module *M, ClusterIDMapType &ClusterIDMap, typedef std::pair<unsigned, ClusterMapType::iterator> SortType; SmallVector<SortType, 64> Sets; - SmallPtrSet<const GlobalValue *, 64> Visited; + SmallPtrSet<const GlobalValue *, 32> Visited; // To guarantee determinism, we have to sort SCC according to size. // When size is the same, use leader's name. |