This is an archive of the discontinued LLVM Phabricator instance.

Fix bugs in SmallBitVector
ClosedPublic

Authored by bmoody on Nov 26 2018, 11:07 PM.

Details

Summary

Fixes:

  • find_last/find_last_unset - off-by-one error
  • Compound assignment ops and operator== when mixing big/small modes

Diff Detail

Event Timeline

bmoody created this revision.Nov 26 2018, 11:07 PM
dexonsmith added inline comments.Nov 26 2018, 11:33 PM
unittests/ADT/BitVectorTest.cpp
237

It's not locally obvious why this clear() is important. Is it cleaner to just split into a separate test? Is there also an ASSERT_* you can add to prove that it's in small mode?

bmoody updated this revision to Diff 175406.Nov 26 2018, 11:59 PM

Reorganize tests for clarity.

Can't see any way to assert that the bit vector is in small mode.

bmoody updated this revision to Diff 175408.Nov 27 2018, 12:06 AM
bmoody marked an inline comment as done.

Probably should have tried to compile that last change before I uploaded it..

Can't see any way to assert that the bit vector is in small mode.

Since it's important for the test, it might be worth adding one.

Is this the same bug described here? https://bugs.llvm.org/show_bug.cgi?id=38996

Can you confirm that it fixes the test cases proposed in that patch?

bmoody updated this revision to Diff 175596.Nov 27 2018, 4:30 PM
bmoody edited the summary of this revision. (Show Details)

New diff that makes SmallBitVector::isSmall() public and adds asserts to the tests.

I don't really agree with this change because I don't think isSmall should be part of SmallBitVector's public interface and I think the test is explicit enough without the asserts. But it's here if you want it.

P.s. I don't have commit access, so you're welcome to make any final tweaks and commit on my behalf.

Also, yes, can confirm this patch fixes the tests in that bug report.

zturner accepted this revision.Nov 29 2018, 11:24 AM
This revision is now accepted and ready to land.Nov 29 2018, 11:24 AM

Any update on getting this committed? I don't have commit access.

This revision was automatically updated to reflect the committed changes.