From 1f017547bb379b6bef829eb20dab284602a0d43b Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Fri, 20 Feb 2015 23:16:52 +0000 Subject: [PATCH] [RewriteStatepointsForGC] Use DenseSet in place of std::set [NFC] This should be the last cleanup on non-llvm preferred data structures. I left one use of std::set in an assertion; DenseSet didn't seem to have a tombstone for CallSite defined. That might be worth fixing, but wasn't worth it for a debug only use. llvm-svn: 230084 --- llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp index 5135452..e086922 100644 --- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp @@ -96,7 +96,7 @@ namespace { // base relation will remain. Internally, we add a mixture of the two // types, then update all the second type to the first type typedef DenseMap DefiningValueMapTy; -typedef std::set StatepointLiveSetTy; +typedef DenseSet StatepointLiveSetTy; struct PartiallyConstructedSafepointRecord { /// The set of values known to be live accross this safepoint @@ -177,7 +177,7 @@ static bool isAggWhichContainsGCPtrType(Type *Ty) { // postconditions: populates liveValues as discussed above static void findLiveGCValuesAtInst(Instruction *term, BasicBlock *pred, DominatorTree &DT, LoopInfo *LI, - std::set &liveValues) { + StatepointLiveSetTy &liveValues) { liveValues.clear(); assert(isa(term) || isa(term) || term->isTerminator()); @@ -277,7 +277,7 @@ analyzeParsePointLiveness(DominatorTree &DT, const CallSite &CS, Instruction *inst = CS.getInstruction(); BasicBlock *BB = inst->getParent(); - std::set liveset; + StatepointLiveSetTy liveset; findLiveGCValuesAtInst(inst, BB, DT, nullptr, liveset); if (PrintLiveSet) { @@ -976,7 +976,7 @@ static Value *findBasePointer(Value *I, DefiningValueMapTy &cache, // post condition: PointerToBase contains one (derived, base) pair for every // pointer in live. Note that derived can be equal to base if the original // pointer was a base pointer. -static void findBasePointers(const std::set &live, +static void findBasePointers(const StatepointLiveSetTy &live, DenseMap &PointerToBase, DominatorTree *DT, DefiningValueMapTy &DVCache, DenseSet &NewInsertedDefs) { @@ -1023,7 +1023,7 @@ static void findBasePointers(DominatorTree &DT, DefiningValueMapTy &DVCache, /// Check for liveness of items in the insert defs and add them to the live /// and base pointer sets static void fixupLiveness(DominatorTree &DT, const CallSite &CS, - const std::set &allInsertedDefs, + const DenseSet &allInsertedDefs, PartiallyConstructedSafepointRecord &result) { Instruction *inst = CS.getInstruction(); @@ -1064,7 +1064,7 @@ static void fixupLiveness(DominatorTree &DT, const CallSite &CS, static void fixupLiveReferences( Function &F, DominatorTree &DT, Pass *P, - const std::set &allInsertedDefs, + const DenseSet &allInsertedDefs, ArrayRef toUpdate, MutableArrayRef records) { for (size_t i = 0; i < records.size(); i++) { @@ -1667,7 +1667,7 @@ static void findLiveReferences( } } -static void addBasesAsLiveValues(std::set &liveset, +static void addBasesAsLiveValues(StatepointLiveSetTy &liveset, DenseMap &PointerToBase) { // Identify any base pointers which are used in this safepoint, but not // themselves relocated. We need to relocate them so that later inserted @@ -1767,7 +1767,7 @@ static bool insertParsePoints(Function &F, DominatorTree &DT, Pass *P, // gep a + 1 // safepoint 2 // br loop - std::set allInsertedDefs; + DenseSet allInsertedDefs; for (size_t i = 0; i < records.size(); i++) { struct PartiallyConstructedSafepointRecord &info = records[i]; allInsertedDefs.insert(info.NewInsertedDefs.begin(), -- 2.7.4