[RewriteStatepointsForGC] Use a SetVector for a worklist [NFC]

Using a SetVector to replace equivelent but more verbose functionality.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234662 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Philip Reames 2015-04-10 23:11:26 +00:00
parent f5e4c28c3f
commit 4cc199a0de

View File

@ -17,6 +17,7 @@
#include "llvm/ADT/SetOperations.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/Dominators.h"
@ -2045,17 +2046,14 @@ static void checkBasicSSA(DominatorTree &DT, GCPtrLivenessData &Data,
static void computeLiveInValues(DominatorTree &DT, Function &F,
GCPtrLivenessData &Data) {
DenseSet<BasicBlock *> WorklistSet;
SmallVector<BasicBlock *, 200> Worklist;
SmallSetVector<BasicBlock *, 200> Worklist;
auto AddPredsToWorklist = [&](BasicBlock *BB) {
for (BasicBlock *Pred : predecessors(BB))
if (WorklistSet.insert(Pred).second)
Worklist.push_back(Pred);
// We use a SetVector so that we don't have duplicates in the worklist.
Worklist.insert(pred_begin(BB), pred_end(BB));
};
auto NextItem = [&]() {
BasicBlock *BB = Worklist.back();
Worklist.pop_back();
WorklistSet.erase(BB);
return BB;
};