[PATCH] D77027: Make BitVector::operator== return false for different-sized vectors

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 7 11:56:23 PDT 2020


Meinersbur added inline comments.


================
Comment at: llvm/include/llvm/ADT/BitVector.h:542
-
-    // Verify that any extra words are all zeros.
-    if (i != ThisWords) {
----------------
dblaikie wrote:
> Hmm - looking at this more closely (ie: I'm now actually looking at the code rather than just the commentary/discussion) this code makes me a bit uncomfortable - looks pretty intentionally designed to support potentially equal comparison of differently lengthed BitVectors. Is there any history of how/when this was added/potentially used?
It was introduced in 2007 by Chris Lattner in r42860 with the commit message "make bitvector  &= do the right thing if vectors have mismatched length." and no other changes. Before that, it asserted on mismatching lengths.

By its name, it's a vector and a comparison that does something else than checking the same elements in the same order is confusing.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77027/new/

https://reviews.llvm.org/D77027





More information about the llvm-commits mailing list