From 8b146240a2883fdbf0a7ad856df84a56c6f0d3d1 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 16 Apr 2010 21:57:10 +0000 Subject: [PATCH] tidy up git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101548 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/SCCIterator.h | 48 ++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/include/llvm/ADT/SCCIterator.h b/include/llvm/ADT/SCCIterator.h index d38ce4cd634..d4f5e5ac7c3 100644 --- a/include/llvm/ADT/SCCIterator.h +++ b/include/llvm/ADT/SCCIterator.h @@ -85,11 +85,12 @@ class scc_iterator if (!nodeVisitNumbers.count(childN)) { // this node has never been seen DFSVisitOne(childN); - } else { - unsigned childNum = nodeVisitNumbers[childN]; - if (MinVisitNumStack.back() > childNum) - MinVisitNumStack.back() = childNum; + continue; } + + unsigned childNum = nodeVisitNumbers[childN]; + if (MinVisitNumStack.back() > childNum) + MinVisitNumStack.back() = childNum; } } @@ -100,7 +101,7 @@ class scc_iterator while (!VisitStack.empty()) { DFSVisitChildren(); assert(VisitStack.back().second ==GT::child_end(VisitStack.back().first)); - NodeType* visitingN = VisitStack.back().first; + NodeType *visitingN = VisitStack.back().first; unsigned minVisitNum = MinVisitNumStack.back(); VisitStack.pop_back(); MinVisitNumStack.pop_back(); @@ -111,18 +112,19 @@ class scc_iterator // " : minVisitNum = " << minVisitNum << "; Node visit num = " << // nodeVisitNumbers[visitingN] << "\n"; - if (minVisitNum == nodeVisitNumbers[visitingN]) { - // A full SCC is on the SCCNodeStack! It includes all nodes below - // visitingN on the stack. Copy those nodes to CurrentSCC, - // reset their minVisit values, and return (this suspends - // the DFS traversal till the next ++). - do { - CurrentSCC.push_back(SCCNodeStack.back()); - SCCNodeStack.pop_back(); - nodeVisitNumbers[CurrentSCC.back()] = ~0U; - } while (CurrentSCC.back() != visitingN); - return; - } + if (minVisitNum != nodeVisitNumbers[visitingN]) + continue; + + // A full SCC is on the SCCNodeStack! It includes all nodes below + // visitingN on the stack. Copy those nodes to CurrentSCC, + // reset their minVisit values, and return (this suspends + // the DFS traversal till the next ++). + do { + CurrentSCC.push_back(SCCNodeStack.back()); + SCCNodeStack.pop_back(); + nodeVisitNumbers[CurrentSCC.back()] = ~0U; + } while (CurrentSCC.back() != visitingN); + return; } } @@ -186,23 +188,23 @@ public: // Global constructor for the SCC iterator. template -scc_iterator scc_begin(const T& G) { +scc_iterator scc_begin(const T &G) { return scc_iterator::begin(G); } template -scc_iterator scc_end(const T& G) { +scc_iterator scc_end(const T &G) { return scc_iterator::end(G); } template -scc_iterator > scc_begin(const Inverse& G) { - return scc_iterator >::begin(G); +scc_iterator > scc_begin(const Inverse &G) { + return scc_iterator >::begin(G); } template -scc_iterator > scc_end(const Inverse& G) { - return scc_iterator >::end(G); +scc_iterator > scc_end(const Inverse &G) { + return scc_iterator >::end(G); } } // End llvm namespace