summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT/BitVectorTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [PowerPC][NFC] Enable ADT BitVectorTestJinsong Ji2019-08-021-4/+0
| | | | | | | Test on ppc64le passed. This fix https://bugs.llvm.org/show_bug.cgi?id=42702 llvm-svn: 367713
* [SmallBitVector] Fix bug in find_next_unset for small types with indices >=32Simon Pilgrim2019-07-211-0/+32
| | | | | | | | We were creating a bitmask from a shift of unsigned instead of uintptr_t, meaning we couldn't create masks for indices above 31. Noticed due to a MSVC analyzer warning. llvm-svn: 366657
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [ADT] Fix bugs in SmallBitVector.Zachary Turner2018-12-141-7/+261
| | | | | | | | | | | Fixes: * find_last/find_last_unset - off-by-one error * Compound assignment ops and operator== when mixing big/small modes Patch by Brad Moody Differential Revision: https://reviews.llvm.org/D54933 llvm-svn: 349173
* Fix -Wsign-compare warnings. NFCISimon Pilgrim2018-09-191-10/+10
| | | | llvm-svn: 342551
* [ADT][BitVector] Add push_back()Simon Pilgrim2018-09-191-0/+31
| | | | | | | | Add a higher performance alternative to calling resize() every time which performs a lot of clearing to zero - when we're adding a single bit most of the time this will be completely unnecessary. Differential Revision: https://reviews.llvm.org/D52236 llvm-svn: 342535
* [BitVector] Add find_[first,last]_[set,unset]_in.Zachary Turner2017-05-171-4/+151
| | | | | | | | | | | | | A lot of code is duplicated between the first_last and the next / prev methods. All of this code can be shared if they are implemented in terms of find_first_in(Begin, End) etc, in which case find_first = find_first_in(0, Size) and find_next is find_first_in(Prev+1, Size), with similar reductions for the other methods. Differential Revision: https://reviews.llvm.org/D33104 llvm-svn: 303269
* BitVector: add iterators for set bitsFrancis Visoiu Mistrih2017-05-171-0/+29
| | | | | | Differential revision: https://reviews.llvm.org/D32060 llvm-svn: 303227
* [ADT] Add BitVector::find_prev.Zachary Turner2017-05-051-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | This almost completes the matrix of all possible find functions. *EXISTING* ---------- find_first find_first_unset find_next find_next_unset find_last find_last_unset *NEW* ---- find_prev *STILL MISSING* --------------- find_prev_unset Differential Revision: https://reviews.llvm.org/D32885 llvm-svn: 302254
* [ADT] A few minor improvements to BitVectorZachary Turner2017-05-051-0/+19
| | | | | | | Fixes some spelling mistakes, uses a helper function, and adds an additional test case. llvm-svn: 302208
* [BitVector] Add find_last() and find_last_unset().Zachary Turner2017-04-211-0/+8
| | | | | | Differential Revision: https://reviews.llvm.org/D32302 llvm-svn: 301014
* Resubmit "[BitVector] Add operator<<= and operator>>=."Zachary Turner2017-04-201-0/+122
| | | | | | | | | This was failing due to the use of assigning a Mask to an unsigned, rather than to a BitWord. But most systems do not have sizeof(unsigned) == sizeof(unsigned long), so the mask was getting truncated. llvm-svn: 300857
* Revert "[BitVector] Add operator<<= and operator>>=."Zachary Turner2017-04-201-122/+0
| | | | | | | This is causing test failures on Linux / BSD systems. Reverting while I investigate. llvm-svn: 300852
* [BitVector] Add operator<<= and operator>>=.Zachary Turner2017-04-201-0/+122
| | | | | | Differential Revision: https://reviews.llvm.org/D32244 llvm-svn: 300848
* Fix signed / unsigned comparison warnings.Zachary Turner2017-04-101-2/+2
| | | | llvm-svn: 299873
* [Support] Add support for finding unset bits in a BitVector.Zachary Turner2017-04-101-0/+39
| | | | | | | | | | | | BitVector had methods for searching for the first and next set bits, but it did not have analagous methods for finding the first and next unset bits. This is useful when your ones and zeros are grouped together and you want to iterate over ranges of ones and zeros. Differential Revision: https://reviews.llvm.org/D31802 llvm-svn: 299857
* Add unittests for empty bitvectors.Matthias Braun2017-01-231-0/+37
| | | | | | Addendum to r292575 llvm-svn: 292817
* Fix BitVector move ctor/assignment.Evgeniy Stepanov2016-06-161-0/+26
| | | | | | | | Current implementation leaves the object in an invalid state. This reverts commit bf0c389ac683cd6c0e5959b16537e59e5f4589e3. llvm-svn: 272965
* Simplify SmallBitVector::applyMask by consolidating common code for 32- and ↵Yaron Keren2015-09-181-2/+2
| | | | | | | | | | | | | 64-bit builds and assert when mask is too large to apply in the small case, previously the extra words were silently ignored. clang-format the entire function to match current code standards. This is a rewrite of r247972 which was reverted in r247983 due to warning and possible UB on 32-bits hosts. llvm-svn: 247993
* Reverting r247972 (and subordinate commit r247972) as the 32-bit left-shift ↵Aaron Ballman2015-09-181-2/+2
| | | | | | is undefined behavior on implementations where uinptr_t is 32-bits. One such platform is Windows, MSVC, x86. llvm-svn: 247983
* Fix BitVectorTest on 32-bit hosts after r247972.Yaron Keren2015-09-181-2/+2
| | | | | | | We can't apply two words of 32-bit mask in the small case where the internal storage is just one 32-bit word. llvm-svn: 247974
* Simplify SmallBitVector::applyMask by consolidating common code for 32-bit ↵Yaron Keren2015-09-181-2/+2
| | | | | | | | | | | | | and 64-bit builds. Extend mask value to 64 bits before taking its complement and assert when mask is too large to apply in the small case (previously the extra words were silently ignored). http://reviews.llvm.org/D11890 Patch by James Touton! llvm-svn: 247972
* Fix a buffer overrun detected by AddressSanitizer.Anna Zaks2013-12-191-0/+6
| | | | llvm-svn: 197647
* Revert "[PowerPC] Improve consistency in use of __ppc__, __powerpc__, etc."Rafael Espindola2013-07-261-1/+1
| | | | | | This reverts commit r187248. It broke many bots. llvm-svn: 187254
* [PowerPC] Improve consistency in use of __ppc__, __powerpc__, etc.Bill Schmidt2013-07-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Both GCC and LLVM will implicitly define __ppc__ and __powerpc__ for all PowerPC targets, whether 32- or 64-bit. They will both implicitly define __ppc64__ and __powerpc64__ for 64-bit PowerPC targets, and not for 32-bit targets. We cannot be sure that all other possible compilers used to compile Clang/LLVM define both __ppc__ and __powerpc__, for example, so it is best to check for both when relying on either inside the Clang/LLVM code base. This patch makes sure we always check for both variants. In addition, it fixes one unnecessary check in lib/Target/PowerPC/PPCJITInfo.cpp. (At least one of __ppc__ and __powerpc__ should always be defined when compiling for a PowerPC target, no matter which compiler is used, so testing for them is unnecessary.) There are some places in the compiler that check for other variants, like __POWERPC__ and _POWER, and I have left those in place. There is no need to add them elsewhere. This seems to be in Apple-specific code, and I won't take a chance on breaking it. There is no intended change in behavior; thus, no test cases are added. llvm-svn: 187248
* Sync SmallBitVector with BitVector. Add unit tests for the missing methods.Benjamin Kramer2013-07-111-0/+36
| | | | llvm-svn: 186123
* BitVector: Do the right thing in all() when Size is a multiple of BITWORD_SIZE.Benjamin Kramer2013-06-071-0/+16
| | | | llvm-svn: 183525
* Optimize BitVector::all().Benjamin Kramer2013-06-071-0/+8
| | | | llvm-svn: 183521
* Fix a bug in the set(I,E)/reset(I,E) methods that I recently added. The ↵Owen Anderson2012-10-161-0/+10
| | | | | | boundary condition for checking if I and E were in the same word were incorrect, and, beyond that, the mask computation was not using a wide enough constant. llvm-svn: 166015
* Add range-based set()/reset() to BitVector. These allow fast ↵Owen Anderson2012-10-151-0/+42
| | | | | | setting/resetting of ranges of bits, particularly useful when dealing with very large BitVector's. llvm-svn: 165984
* Merge the SmallBitVector and BitVector unit tests with gtest's typed test ↵Benjamin Kramer2012-06-161-16/+25
| | | | | | magic and bring SmallBitVector up to date. llvm-svn: 158600
* Remove the expensive BitVector::operator~().Jakob Stoklund Olesen2012-05-141-3/+4
| | | | | | | Returning a temporary BitVector is very expensive. If you must, create the temporary explicitly: Use BitVector(A).flip() instead of ~A. llvm-svn: 156768
* Add BitVector::anyCommon().Jakob Stoklund Olesen2012-05-141-1/+29
| | | | | | The existing operation (A & B).any() is very slow. llvm-svn: 156760
* Add portable bit mask operations to BitVector.Jakob Stoklund Olesen2012-01-171-0/+46
| | | | | | | | | | | | BitVector uses the native word size for its internal representation. That doesn't work well for literal bit masks in source code. This patch adds BitVector operations to efficiently apply literal bit masks specified as arrays of uint32_t. Since each array entry always holds exactly 32 bits, these portable bit masks can be source code literals, probably produced by TableGen. llvm-svn: 148272
* Add an all() method to BitVector, for testing whether all bits are set.Dan Gohman2010-09-271-0/+7
| | | | llvm-svn: 114830
* Update BitVectorTest.cpp to stay in sync with SmallBitVectorTest.cpp,Dan Gohman2010-04-301-3/+15
| | | | | | and fix a bug in BitVector's reference proxy class which this exposed. llvm-svn: 102768
* Silence GCC warnings.Benjamin Kramer2010-02-101-6/+6
| | | | llvm-svn: 95779
* Implement operators |=, &=, and ^= for SmallBitVector, and remove theDan Gohman2010-02-101-0/+40
| | | | | | | restriction in BitVector for |= and ^= that the operand must be the same length. llvm-svn: 95768
* Disable unittests/ADT/BitVectorTest on PPC Darwin.Dale Johannesen2010-02-091-0/+2
| | | | | | | | | It fails with a release build only, for reasons as yet unknown. (If there's a better way to Xfail things here let me know, doesn't seem to be any prior art in unittests.) llvm-svn: 95700
* Add a SmallBitVector class, which mimics BitVector but uses onlyDan Gohman2010-01-051-0/+140
a single pointer (PointerIntPair) member. In "small" mode, the pointer field is reinterpreted as a set of bits. In "large" mode, the pointer points to a heap-allocated object. Also, give BitVector empty and swap functions. And, add some simple unittests for BitVector and SmallBitVector. llvm-svn: 92730
OpenPOWER on IntegriCloud