Fix intersectWithComplement bug noticed by Curtis Dunham

Optimize |= case for empty RHS


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42629 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Berlin 2007-10-05 05:10:53 +00:00
parent eca18214bb
commit ad92c633c7

View File

@ -580,8 +580,8 @@ public:
ElementListIter Iter1 = Elements.begin(); ElementListIter Iter1 = Elements.begin();
ElementListConstIter Iter2 = RHS.Elements.begin(); ElementListConstIter Iter2 = RHS.Elements.begin();
// Check if both bitmaps are empty // If RHS is empty, we are done
if (Elements.empty() && RHS.Elements.empty()) if (RHS.Elements.empty())
return false; return false;
while (Iter2 != RHS.Elements.end()) { while (Iter2 != RHS.Elements.end()) {
@ -671,9 +671,7 @@ public:
} }
++Iter2; ++Iter2;
} else { } else {
ElementListIter IterTmp = Iter1;
++Iter1; ++Iter1;
Elements.erase(IterTmp);
} }
} }
CurrElementIter = Elements.begin(); CurrElementIter = Elements.begin();