From ad92c633c7845e3a8103db5a9ae9231c03b9fb58 Mon Sep 17 00:00:00 2001 From: Daniel Berlin Date: Fri, 5 Oct 2007 05:10:53 +0000 Subject: [PATCH] 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 --- include/llvm/ADT/SparseBitVector.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/llvm/ADT/SparseBitVector.h b/include/llvm/ADT/SparseBitVector.h index 1d96546954a..86fb2b4eb44 100644 --- a/include/llvm/ADT/SparseBitVector.h +++ b/include/llvm/ADT/SparseBitVector.h @@ -580,8 +580,8 @@ public: ElementListIter Iter1 = Elements.begin(); ElementListConstIter Iter2 = RHS.Elements.begin(); - // Check if both bitmaps are empty - if (Elements.empty() && RHS.Elements.empty()) + // If RHS is empty, we are done + if (RHS.Elements.empty()) return false; while (Iter2 != RHS.Elements.end()) { @@ -671,9 +671,7 @@ public: } ++Iter2; } else { - ElementListIter IterTmp = Iter1; ++Iter1; - Elements.erase(IterTmp); } } CurrElementIter = Elements.begin();