[llvm] r219505 - Reduce double set lookups. NFC.
Benjamin Kramer
benny.kra at googlemail.com
Fri Oct 10 08:32:50 PDT 2014
Author: d0k
Date: Fri Oct 10 10:32:50 2014
New Revision: 219505
URL: http://llvm.org/viewvc/llvm-project?rev=219505&view=rev
Log:
Reduce double set lookups. NFC.
Modified:
llvm/trunk/include/llvm/Analysis/DominanceFrontierImpl.h
llvm/trunk/include/llvm/Analysis/IntervalIterator.h
llvm/trunk/lib/CodeGen/AggressiveAntiDepBreaker.cpp
llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp
llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
Modified: llvm/trunk/include/llvm/Analysis/DominanceFrontierImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DominanceFrontierImpl.h?rev=219505&r1=219504&r2=219505&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DominanceFrontierImpl.h (original)
+++ llvm/trunk/include/llvm/Analysis/DominanceFrontierImpl.h Fri Oct 10 10:32:50 2014
@@ -172,9 +172,7 @@ ForwardDominanceFrontierBase<BlockT>::ca
DomSetType &S = this->Frontiers[currentBB];
// Visit each block only once.
- if (visited.count(currentBB) == 0) {
- visited.insert(currentBB);
-
+ if (visited.insert(currentBB)) {
// Loop over CFG successors to calculate DFlocal[currentNode]
for (auto SI = BlockTraits::child_begin(currentBB),
SE = BlockTraits::child_end(currentBB);
Modified: llvm/trunk/include/llvm/Analysis/IntervalIterator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/IntervalIterator.h?rev=219505&r1=219504&r2=219505&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/IntervalIterator.h (original)
+++ llvm/trunk/include/llvm/Analysis/IntervalIterator.h Fri Oct 10 10:32:50 2014
@@ -165,10 +165,10 @@ private:
//
bool ProcessInterval(NodeTy *Node) {
BasicBlock *Header = getNodeHeader(Node);
- if (Visited.count(Header)) return false;
+ if (!Visited.insert(Header).second)
+ return false;
Interval *Int = new Interval(Header);
- Visited.insert(Header); // The header has now been visited!
// Check all of our successors to see if they are in the interval...
for (typename GT::ChildIteratorType I = GT::child_begin(Node),
Modified: llvm/trunk/lib/CodeGen/AggressiveAntiDepBreaker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AggressiveAntiDepBreaker.cpp?rev=219505&r1=219504&r2=219505&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AggressiveAntiDepBreaker.cpp (original)
+++ llvm/trunk/lib/CodeGen/AggressiveAntiDepBreaker.cpp Fri Oct 10 10:32:50 2014
@@ -257,11 +257,8 @@ static void AntiDepEdges(const SUnit *SU
for (SUnit::const_pred_iterator P = SU->Preds.begin(), PE = SU->Preds.end();
P != PE; ++P) {
if ((P->getKind() == SDep::Anti) || (P->getKind() == SDep::Output)) {
- unsigned Reg = P->getReg();
- if (RegSet.count(Reg) == 0) {
+ if (RegSet.insert(P->getReg()))
Edges.push_back(&*P);
- RegSet.insert(Reg);
- }
}
}
}
@@ -615,8 +612,7 @@ bool AggressiveAntiDepBreaker::FindSuita
DEBUG(dbgs() << "\tFind Registers:");
- if (RenameOrder.count(SuperRC) == 0)
- RenameOrder.insert(RenameOrderType::value_type(SuperRC, Order.size()));
+ RenameOrder.insert(RenameOrderType::value_type(SuperRC, Order.size()));
unsigned OrigR = RenameOrder[SuperRC];
unsigned EndR = ((OrigR == Order.size()) ? 0 : OrigR);
Modified: llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp?rev=219505&r1=219504&r2=219505&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp (original)
+++ llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp Fri Oct 10 10:32:50 2014
@@ -410,9 +410,9 @@ std::error_code readCoverageMappingData(
// function name.
// This is useful to ignore the redundant records for the functions
// with ODR linkage.
- if (UniqueFunctionMappingData.count(MappingRecord.FunctionNamePtr))
+ if (!UniqueFunctionMappingData.insert(MappingRecord.FunctionNamePtr)
+ .second)
continue;
- UniqueFunctionMappingData.insert(MappingRecord.FunctionNamePtr);
StringRef FunctionName;
if (auto Err =
ProfileNames.get(MappingRecord.FunctionNamePtr,
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp?rev=219505&r1=219504&r2=219505&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp Fri Oct 10 10:32:50 2014
@@ -88,12 +88,9 @@ void VisitGlobalVariableForEmission(
return;
// Do we have a circular dependency?
- if (Visiting.count(GV))
+ if (!Visiting.insert(GV).second)
report_fatal_error("Circular dependency found in global variable set");
- // Start visiting this global
- Visiting.insert(GV);
-
// Make sure we visit all dependents first
DenseSet<const GlobalVariable *> Others;
for (unsigned i = 0, e = GV->getNumOperands(); i != e; ++i)
More information about the llvm-commits
mailing list