diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2016-06-17 18:59:41 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2016-06-17 18:59:41 +0000 |
commit | 4dea8f542b59973ea19f1826b6d18c99d7a047c1 (patch) | |
tree | 85665abd293ea9ee6be3895d646093c2428659db /llvm/lib/Transforms/Scalar | |
parent | 28a9e7f4ba8d3bb8cca4d521f0089cd449227769 (diff) | |
download | bcm5719-llvm-4dea8f542b59973ea19f1826b6d18c99d7a047c1.tar.gz bcm5719-llvm-4dea8f542b59973ea19f1826b6d18c99d7a047c1.zip |
Avoid duplicated map lookups. No functionality change intended.
llvm-svn: 273030
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r-- | llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/StructurizeCFG.cpp | 10 |
3 files changed, 5 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp b/llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp index 1cadab625b0..029178388b7 100644 --- a/llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp +++ b/llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp @@ -277,9 +277,8 @@ static void scanOneBB(Instruction *Start, Instruction *End, if (BBI->isTerminator()) { BasicBlock *BB = BBI->getParent(); for (BasicBlock *Succ : successors(BB)) { - if (Seen.count(Succ) == 0) { + if (Seen.insert(Succ).second) { Worklist.push_back(Succ); - Seen.insert(Succ); } } } diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp index 21c0c9d97ab..fe15d17212c 100644 --- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp @@ -2616,9 +2616,8 @@ static void recomputeLiveInValues(GCPtrLivenessData &RevisedLivenessData, // We may have base pointers which are now live that weren't before. We need // to update the PointerToBase structure to reflect this. for (auto V : Updated) - if (!Info.PointerToBase.count(V)) { + if (Info.PointerToBase.insert(std::make_pair(V, V)).second) { assert(Bases.count(V) && "can't find base for unexpected live value"); - Info.PointerToBase[V] = V; continue; } diff --git a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp index 675614dca95..802b3e476aa 100644 --- a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp +++ b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp @@ -311,11 +311,7 @@ void StructurizeCFG::orderNodes() { for (RegionNode *RN : TempOrder) { BasicBlock *BB = RN->getEntry(); Loop *Loop = LI->getLoopFor(BB); - if (!LoopBlocks.count(Loop)) { - LoopBlocks[Loop] = 1; - continue; - } - LoopBlocks[Loop]++; + ++LoopBlocks[Loop]; } unsigned CurrentLoopDepth = 0; @@ -333,11 +329,11 @@ void StructurizeCFG::orderNodes() { // the outer loop. RNVector::iterator LoopI = I; - while(LoopBlocks[CurrentLoop]) { + while (unsigned &BlockCount = LoopBlocks[CurrentLoop]) { LoopI++; BasicBlock *LoopBB = (*LoopI)->getEntry(); if (LI->getLoopFor(LoopBB) == CurrentLoop) { - LoopBlocks[CurrentLoop]--; + --BlockCount; Order.push_back(*LoopI); } } |