mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-10 22:00:58 +00:00
Optimize po_iterator: don't do redundant lookups.
llvm-svn: 125211
This commit is contained in:
parent
bd07266baa
commit
a5cb7ac412
@ -56,8 +56,7 @@ class po_iterator : public std::iterator<std::forward_iterator_tag,
|
|||||||
void traverseChild() {
|
void traverseChild() {
|
||||||
while (VisitStack.back().second != GT::child_end(VisitStack.back().first)) {
|
while (VisitStack.back().second != GT::child_end(VisitStack.back().first)) {
|
||||||
NodeType *BB = *VisitStack.back().second++;
|
NodeType *BB = *VisitStack.back().second++;
|
||||||
if (!this->Visited.count(BB)) { // If the block is not visited...
|
if (this->Visited.insert(BB)) { // If the block is not visited...
|
||||||
this->Visited.insert(BB);
|
|
||||||
VisitStack.push_back(std::make_pair(BB, GT::child_begin(BB)));
|
VisitStack.push_back(std::make_pair(BB, GT::child_begin(BB)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,8 +71,7 @@ class po_iterator : public std::iterator<std::forward_iterator_tag,
|
|||||||
|
|
||||||
inline po_iterator(NodeType *BB, SetType &S) :
|
inline po_iterator(NodeType *BB, SetType &S) :
|
||||||
po_iterator_storage<SetType, ExtStorage>(S) {
|
po_iterator_storage<SetType, ExtStorage>(S) {
|
||||||
if(!S.count(BB)) {
|
if (this->Visited.insert(BB)) {
|
||||||
this->Visited.insert(BB);
|
|
||||||
VisitStack.push_back(std::make_pair(BB, GT::child_begin(BB)));
|
VisitStack.push_back(std::make_pair(BB, GT::child_begin(BB)));
|
||||||
traverseChild();
|
traverseChild();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user