Reduce double set lookups. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219505 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer
2014-10-10 15:32:50 +00:00
parent 836ca75dd7
commit d62c4bac66
5 changed files with 8 additions and 17 deletions

View File

@@ -172,9 +172,7 @@ ForwardDominanceFrontierBase<BlockT>::calculate(const DomTreeT &DT,
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);

View File

@@ -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),