This is an archive of the discontinued LLVM Phabricator instance.

Fix bug in SmallBitVector::find_next_unset
ClosedPublic

Authored by bmoody on Apr 12 2020, 5:46 PM.

Details

Summary

find_next_unset was returning size() instead of -1 in small-mode, when no unset bits are found.

Diff Detail

Event Timeline

bmoody created this revision.Apr 12 2020, 5:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 12 2020, 5:46 PM
Herald added a subscriber: dexonsmith. · View Herald Transcript

Ping! Could anyone take a look at this?

dblaikie accepted this revision.Apr 21 2020, 10:37 AM

Sounds good - thanks!

This revision is now accepted and ready to land.Apr 21 2020, 10:37 AM
dantrushin added inline comments.
llvm/include/llvm/ADT/SmallBitVector.h
296

Wouldn't it be simpler to leave ++Prev from line 290 in place and then just use Prev ?

bmoody marked an inline comment as done.Apr 21 2020, 5:08 PM

Great! Please commit this on my behalf, as I don't have commit access. Thanks.

llvm/include/llvm/ADT/SmallBitVector.h
296

IMO modifying parameter values can make code more confusing at a glance, so I try to avoid it. But the main reason I did this was to make the code as close to the find_next implementation above as possible.

This revision was automatically updated to reflect the committed changes.