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

View File

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

View File

@ -1604,7 +1604,8 @@ protected:
E = SortedCategories.end();
Category != E; ++Category) {
// 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)
continue;
@ -1625,11 +1626,8 @@ protected:
continue;
}
// Loop over the options in the category and print.
for (std::vector<Option *>::const_iterator
Opt = CategorizedOptions[*Category].begin(),
E = CategorizedOptions[*Category].end();
Opt != E; ++Opt)
(*Opt)->printOptionInfo(MaxArgLen);
for (const Option *Opt : CategoryOptions)
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 (Val.back() != 'f' && Val.back() != 'd') {
RecipMap[Val.str() + 'd'].Enabled = !IsDisabled;
RecipParams &Params = RecipMap[Val.str() + 'd'];
Params.Enabled = !IsDisabled;
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()) {
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);
}
}
}

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
// 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;
}

View File

@ -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);
}
}