Reduce double set lookups.
[oota-llvm.git] / include / llvm / ADT / DepthFirstIterator.h
index 6cd9e68aea56c87a3eda598948062543caea0713..657fe6867f2da242be58b7d1b7d9d11cc007e9c7 100644 (file)
@@ -113,9 +113,8 @@ private:
       while (It != GT::child_end(Node)) {
         NodeType *Next = *It++;
         // Has our next sibling been visited?
-        if (Next && !this->Visited.count(Next)) {  
+        if (Next && this->Visited.insert(Next).second) {
           // No, do it now.
-          this->Visited.insert(Next);
           VisitStack.push_back(std::make_pair(PointerIntTy(Next, 0), 
                                               GT::child_begin(Next)));
           return;