Avoid duplicated map lookups. No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273030 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2016-06-17 18:59:41 +00:00
parent d476afda38
commit c22fa67ab0
7 changed files with 15 additions and 25 deletions

View File

@ -365,9 +365,8 @@ MemoryDependenceResults::getInvariantGroupPointerDependency(LoadInst *LI,
continue; continue;
if (auto *BCI = dyn_cast<BitCastInst>(Ptr)) { if (auto *BCI = dyn_cast<BitCastInst>(Ptr)) {
if (!Seen.count(BCI->getOperand(0))) { if (Seen.insert(BCI->getOperand(0)).second) {
LoadOperandsQueue.push_back(BCI->getOperand(0)); LoadOperandsQueue.push_back(BCI->getOperand(0));
Seen.insert(BCI->getOperand(0));
} }
} }
@ -377,9 +376,8 @@ MemoryDependenceResults::getInvariantGroupPointerDependency(LoadInst *LI,
continue; continue;
if (auto *BCI = dyn_cast<BitCastInst>(U)) { if (auto *BCI = dyn_cast<BitCastInst>(U)) {
if (!Seen.count(BCI)) { if (Seen.insert(BCI).second) {
LoadOperandsQueue.push_back(BCI); LoadOperandsQueue.push_back(BCI);
Seen.insert(BCI);
} }
continue; continue;
} }

View File

@ -487,8 +487,7 @@ bool LiveDebugValues::ExtendRanges(MachineFunction &MF) {
if (OLChanged) { if (OLChanged) {
OLChanged = false; OLChanged = false;
for (auto s : MBB->successors()) for (auto s : MBB->successors())
if (!OnPending.count(s)) { if (OnPending.insert(s).second) {
OnPending.insert(s);
Pending.push(BBToOrder[s]); Pending.push(BBToOrder[s]);
} }
} }

View File

@ -1604,7 +1604,8 @@ protected:
E = SortedCategories.end(); E = SortedCategories.end();
Category != E; ++Category) { Category != E; ++Category) {
// Hide empty categories for -help, but show for -help-hidden. // Hide empty categories for -help, but show for -help-hidden.
bool IsEmptyCategory = CategorizedOptions[*Category].size() == 0; const auto &CategoryOptions = CategorizedOptions[*Category];
bool IsEmptyCategory = CategoryOptions.empty();
if (!ShowHidden && IsEmptyCategory) if (!ShowHidden && IsEmptyCategory)
continue; continue;
@ -1625,11 +1626,8 @@ protected:
continue; continue;
} }
// Loop over the options in the category and print. // Loop over the options in the category and print.
for (std::vector<Option *>::const_iterator for (const Option *Opt : CategoryOptions)
Opt = CategorizedOptions[*Category].begin(), Opt->printOptionInfo(MaxArgLen);
E = CategorizedOptions[*Category].end();
Opt != E; ++Opt)
(*Opt)->printOptionInfo(MaxArgLen);
} }
} }
}; };

View File

@ -156,9 +156,10 @@ void TargetRecip::parseIndividualParams(const std::vector<std::string> &Args) {
// If the precision was not specified, the double entry is also initialized. // If the precision was not specified, the double entry is also initialized.
if (Val.back() != 'f' && Val.back() != 'd') { if (Val.back() != 'f' && Val.back() != 'd') {
RecipMap[Val.str() + 'd'].Enabled = !IsDisabled; RecipParams &Params = RecipMap[Val.str() + 'd'];
Params.Enabled = !IsDisabled;
if (!RefStepString.empty()) if (!RefStepString.empty())
RecipMap[Val.str() + 'd'].RefinementSteps = RefSteps; Params.RefinementSteps = RefSteps;
} }
} }
} }

View File

@ -277,9 +277,8 @@ static void scanOneBB(Instruction *Start, Instruction *End,
if (BBI->isTerminator()) { if (BBI->isTerminator()) {
BasicBlock *BB = BBI->getParent(); BasicBlock *BB = BBI->getParent();
for (BasicBlock *Succ : successors(BB)) { for (BasicBlock *Succ : successors(BB)) {
if (Seen.count(Succ) == 0) { if (Seen.insert(Succ).second) {
Worklist.push_back(Succ); Worklist.push_back(Succ);
Seen.insert(Succ);
} }
} }
} }

View File

@ -2616,9 +2616,8 @@ static void recomputeLiveInValues(GCPtrLivenessData &RevisedLivenessData,
// We may have base pointers which are now live that weren't before. We need // We may have base pointers which are now live that weren't before. We need
// to update the PointerToBase structure to reflect this. // to update the PointerToBase structure to reflect this.
for (auto V : Updated) 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"); assert(Bases.count(V) && "can't find base for unexpected live value");
Info.PointerToBase[V] = V;
continue; continue;
} }

View File

@ -311,11 +311,7 @@ void StructurizeCFG::orderNodes() {
for (RegionNode *RN : TempOrder) { for (RegionNode *RN : TempOrder) {
BasicBlock *BB = RN->getEntry(); BasicBlock *BB = RN->getEntry();
Loop *Loop = LI->getLoopFor(BB); Loop *Loop = LI->getLoopFor(BB);
if (!LoopBlocks.count(Loop)) { ++LoopBlocks[Loop];
LoopBlocks[Loop] = 1;
continue;
}
LoopBlocks[Loop]++;
} }
unsigned CurrentLoopDepth = 0; unsigned CurrentLoopDepth = 0;
@ -333,11 +329,11 @@ void StructurizeCFG::orderNodes() {
// the outer loop. // the outer loop.
RNVector::iterator LoopI = I; RNVector::iterator LoopI = I;
while(LoopBlocks[CurrentLoop]) { while (unsigned &BlockCount = LoopBlocks[CurrentLoop]) {
LoopI++; LoopI++;
BasicBlock *LoopBB = (*LoopI)->getEntry(); BasicBlock *LoopBB = (*LoopI)->getEntry();
if (LI->getLoopFor(LoopBB) == CurrentLoop) { if (LI->getLoopFor(LoopBB) == CurrentLoop) {
LoopBlocks[CurrentLoop]--; --BlockCount;
Order.push_back(*LoopI); Order.push_back(*LoopI);
} }
} }