summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT
Commit message (Collapse)AuthorAgeFilesLines
...
* Added a unit test for r173983 that verifies that Target.isiOS() works correctly.Michael Gottesman2013-01-301-0/+30
| | | | | | | As a bonus I put in some extra checks to make sure that we are identifying the machine word of various Mac OS X/iOS targets appropriately. llvm-svn: 173994
* Add file to CMakeLists (file added in r173505)Dmitri Gribenko2013-01-251-0/+1
| | | | llvm-svn: 173513
* Add an insert() method to MapVector. Adds the first MapVector unit test.Nick Lewycky2013-01-251-0/+41
| | | | llvm-svn: 173505
* APFloat: Make sure that we get a well-formed x87 NaN when converting from a ↵Benjamin Kramer2013-01-251-0/+26
| | | | | | | | smaller type. Fixes PR15054. llvm-svn: 173459
* ADT/SparseMultiSetTest.cpp: Try to appease cygwin-clang on stage2, take two. ↵NAKAMURA Takumi2013-01-221-1/+1
| | | | | | [-Wsign-compare] llvm-svn: 173144
* ADT/SparseMultiSetTest.cpp: Try to appease cygwin-clang (libstdc++-4.5) on ↵NAKAMURA Takumi2013-01-221-2/+2
| | | | | | stage2. [-Wsign-compare] llvm-svn: 173127
* Introduce a new data structure, the SparseMultiSet, and changes to the MI ↵Michael Ilseman2013-01-212-0/+236
| | | | | | | | scheduler to use it. A SparseMultiSet adds multiset behavior to SparseSet, while retaining SparseSet's desirable properties. Essentially, SparseMultiSet provides multiset behavior by storing its dense data in doubly linked lists that are inlined into the dense vector. This allows it to provide good data locality as well as vector-like constant-time clear() and fast constant time find(), insert(), and erase(). It also allows SparseMultiSet to have a builtin recycler rather than keeping SparseSet's behavior of always swapping upon removal, which allows it to preserve more iterators. It's often a better alternative to a SparseSet of a growable container or vector-of-vector. llvm-svn: 173064
* Implement APFloat::isDenormal()Shuxin Yang2013-01-071-0/+52
| | | | llvm-svn: 171764
* Add an iplist::clearAndLeakNodesUnsafely() function.Jakob Stoklund Olesen2013-01-041-0/+33
| | | | | | | | | | | | The iplist::clear() function can be quite expensive because it traverses the entire list, calling deleteNode() and removeNodeFromList() on each element. If node destruction and deallocation can be handled some other way, clearAndLeakNodesUnsafely() can be used to jettison all nodes without bringing them into cache. The function name is meant to be ominous. llvm-svn: 171540
* Sort a few more #include lines in tools/... unittests/... and utils/...Chandler Carruth2013-01-021-1/+1
| | | | llvm-svn: 171363
* Add an assertion for a likely ilist::splice() contract violation.Jakob Stoklund Olesen2012-12-181-0/+21
| | | | | | | | | | | | | | | | | | | | | | | The single-element ilist::splice() function supports a noop move: List.splice(I, List, I); The corresponding std::list function doesn't allow that, so add a unit test to document that behavior. This also means that List.splice(I, List, F); is somewhat surprisingly not equivalent to List.splice(I, List, F, next(F)); This patch adds an assertion to catch the illegal case I == F above. Alternatively, we could make I == F a legal noop, but that would make ilist differ even more from std::list. llvm-svn: 170443
* Sort the #include lines for unittest/...Chandler Carruth2012-12-049-19/+19
| | | | llvm-svn: 169250
* Switch LLVM_USE_RVALUE_REFERENCES to LLVM_HAS_RVALUE_REFERENCES.Chandler Carruth2012-11-301-17/+17
| | | | | | | | | | | | | | Rationale: 1) This was the name in the comment block. ;] 2) It matches Clang's __has_feature naming convention. 3) It matches other compiler-feature-test conventions. Sorry for the noise. =] I've also switch the comment block to use a \brief tag and not duplicate the name. llvm-svn: 168996
* Drop the limitation to IEEE floating point types from the fdiv of pow2 -> ↵Benjamin Kramer2012-11-081-0/+6
| | | | | | | | fmul transform. This is safe for x87 long doubles and ppc double doubles too. llvm-svn: 167582
* Implement arithmetic on APFloat with PPCDoubleDouble semantics byUlrich Weigand2012-10-291-0/+36
| | | | | | | | | | | | treating it as if it were an IEEE floating-point type with 106-bit mantissa. This makes compile-time arithmetic on "long double" for PowerPC in clang (in particular parsing of floating point constants) work, and fixes all "long double" related failures in the test suite. llvm-svn: 166951
* Fixed bug in SmallDenseMap where it wouldn't leave enough space for an empty ↵Pete Cooper2012-10-231-0/+33
| | | | | | bucket if the number of values was exactly equal to the small capacity. This led to an infinite loop when finding a non-existent element llvm-svn: 166492
* 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
* Update CMake build.Benjamin Kramer2012-10-141-0/+1
| | | | llvm-svn: 165908
* Fix a typo that made ImmutableMap::getMaxElement() useless.Benjamin Kramer2012-10-141-0/+50
| | | | | | Add a basic unit test for ImmutableMap. Found by inspection. llvm-svn: 165907
* Add powerpc-ibm-aix to Triple. Patch by Kai.Duncan Sands2012-10-121-0/+12
| | | | llvm-svn: 165792
* Use unsigned long long instead of uin64_t for OS where that matters.Nick Kledzik2012-10-031-1/+1
| | | | llvm-svn: 165147
* Don't call getAsUnsignedInteger directly, it fails to compile if uint64_t is ↵Benjamin Kramer2012-10-031-1/+5
| | | | | | | | not "unsigned long long". while there add more test cases. llvm-svn: 165140
* Add getAsUnsignedInteger test case that checks that known bad values are ↵Nick Kledzik2012-10-031-0/+19
| | | | | | rejected llvm-svn: 165136
* APFloat::roundToIntegral: Special values don't keep the exponent value up to ↵Benjamin Kramer2012-09-261-0/+17
| | | | | | | | date, don't rely on it. Add a couple of unit tests for special floats. Fixes 13929, found by MemorySanitizer. llvm-svn: 164698
* Fix includes of llvm files that used angle brackets.Craig Topper2012-09-151-1/+1
| | | | llvm-svn: 163979
* ADTTests: [CMake] Exclude DenseMapTest.cpp and SmallVectorTest.cpp on MSVC9 ↵NAKAMURA Takumi2012-08-301-1/+14
| | | | | | due to its bug. llvm-svn: 162918
* Fix another roundToIntegral bug where very large values could become ↵Owen Anderson2012-08-151-1/+14
| | | | | | infinity. Problem and solution identified by Steve Canon. llvm-svn: 161969
* Fix a problem with APFloat::roundToIntegral where it would return incorrect ↵Owen Anderson2012-08-151-0/+30
| | | | | | results for negative inputs to trunc. Add unit tests to verify this behavior. llvm-svn: 161929
* Add range erase, element insert, and range insert methods toChandler Carruth2012-08-011-0/+91
| | | | | | | | | | | | | | | TinyPtrVector. With these, it is sufficiently functional for my more normal / pedestrian uses. I've not included some r-value reference stuff here because the value type for a TinyPtrVector is, necessarily, just a pointer. I've added tests that cover the basic behavior of these routines, but they aren't as comprehensive as I'd like. In particular, they don't really test the iterator semantics as thoroughly as they should. Maybe some brave soul will feel enterprising and flesh them out. ;] llvm-svn: 161104
* Implement copy and move assignment for TinyPtrVector. These try toChandler Carruth2012-07-311-0/+166
| | | | | | re-use allocated vectors as much as possible. llvm-svn: 161041
* Bring TinyPtrVector under test. Somehow we never picked up unit testsChandler Carruth2012-07-312-0/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | | for this class. These tests exercise most of the basic properties, but the API for TinyPtrVector is very strange currently. My plan is to start fleshing out the API to match that of SmallVector, but I wanted a test for what is there first. Sadly, it doesn't look reasonable to just re-use the SmallVector tests, as this container can only ever store pointers, and much of the SmallVector testing is to get construction and destruction right. Just to get this basic test working, I had to add value_type to the interface. While here I found a subtle bug in the combination of 'erase', 'begin', and 'end'. Both 'begin' and 'end' wanted to use a null pointer to indicate the "end" iterator of an empty vector, regardless of whether there is actually a vector allocated or the pointer union is null. Everything else was fine with this except for erase. If you erase the last element of a vector after it has held more than one element, we return the end iterator of the underlying SmallVector which need not be a null pointer. Instead, simply use the pointer, and poniter + size() begin/end definitions in the tiny case, and delegate to the inner vector whenever it is present. llvm-svn: 161024
* Move the SmallVector unit tests to be type-parameterized so that we canChandler Carruth2012-07-301-149/+176
| | | | | | | | | | | | | | | | | | | | test more than a single instantiation of SmallVector. Add testing for 0, 1, 2, and 4 element sized "small" buffers. These appear to be essentially untested in the unit tests until now. Fix several tests to be robust in the face of a '0' small buffer. As a consequence of this size buffer, the growth patterns are actually observable in the test -- yes this means that many tests never caused a grow to occur before. For some tests I've merely added a reserve call to normalize behavior. For others, the growth is actually interesting, and so I captured the fact that growth would occur and adjusted the assertions to not assume how rapidly growth occured. Also update the specialization for a '0' small buffer length to have all the same interface points as the normal small vector. llvm-svn: 161001
* Completely refactor the structuring of unittest CMake files to match theChandler Carruth2012-06-211-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makefiles, the CMake files in every other part of the LLVM tree, and sanity. This should also restore the output tree structure of all the unit tests, sorry for breaking that, and thanks for letting me know. The fundamental change is to put a CMakeLists.txt file in the unittest directory, with a single test binary produced from it. This has several advantages: - No more weird directory stripping in the unittest macro, allowing it to be used more readily in other projects. - No more directory prefixes on all the source files. - Allows correct and precise use of LLVM's per-directory dependency system. - Allows use of the checking logic for source files that have not been added to the CMake build. This uncovered a file being skipped with CMake in LLVM and one in Clang's unit tests. - Makes Specifying conditional compilation or other custom logic for JIT tests easier. It did require adding the concept of an explicit 'optional' source file to the CMake build so that the missing-file check can skip cases where the file is *supposed* to be missing. =] This is another chunk of refactoring the CMake build in order to make it usable for other clients like CompilerRT / ASan / TSan. Note that this is interdependent with a Clang CMake change. llvm-svn: 158909
* Fix PR13148, an inf-loop in StringMap.Chandler Carruth2012-06-191-0/+22
| | | | | | | | | | | | | | | StringMap suffered from the same bug as DenseMap: when you explicitly construct it with a small number of buckets, you can arrange for the tombstone-based growth path to be followed when the number of buckets was less than '8'. In that case, even with a full map, it would compare '0' as not less than '0', and refuse to grow the table, leading to inf-loops trying to find an empty bucket on the next insertion. The fix is very simple: use '<=' as the comparison. The same fix was applied to DenseMap as well during its recent refactoring. Thanks to Alex Bolz for the great report and test case. =] llvm-svn: 158725
* Remove some superfluous SCOPED_TRACEs from this unit test.Chandler Carruth2012-06-191-6/+0
| | | | | | | GoogleTest already prints errors with all the information about which test case contained the error. llvm-svn: 158724
* Remove SmallMap unittests, unbreaking the build.Benjamin Kramer2012-06-171-162/+0
| | | | | | I don't know how useful these are for SmallDenseMap, I'll leave that decision to Chandler. llvm-svn: 158646
* Bring the return value of SmallVector::insert in line with std::vector::insert.Benjamin Kramer2012-06-171-4/+30
| | | | | | | | It always returns the iterator for the first inserted element, or the passed in iterator if the inserted range was empty. Flesh out the unit test more and fix all the cases it uncovered so far. llvm-svn: 158645
* SmallVector: return a valid iterator for the rare case of inserting an empty ↵Benjamin Kramer2012-06-171-0/+7
| | | | | | | | range into a SmallVector. Patch by Johannes Schaub! llvm-svn: 158643
* Add a unit test for 'swap', and fix a pile of bugs inChandler Carruth2012-06-171-0/+36
| | | | | | | | | | | | | | | SmallDenseMap::swap. First, make it parse cleanly. Yay for uninstantiated methods. Second, make the inline-buckets case work correctly. This is way trickier than it should be due to the uninitialized values in empty and tombstone buckets. Finally fix a few typos that caused construction/destruction mismatches in the counting unittest. llvm-svn: 158641
* Add tests for *DenesMap for both key and value types' construction andChandler Carruth2012-06-171-1/+46
| | | | | | | | | | | | | | | | | | | destruction and fix a bug in SmallDenseMap they caught. This is kind of a poor-man's version of the testing that just adds the addresses to a set on construction and removes them on destruction. We check that double construction and double destruction don't occur. Amusingly enough, this is enough to catch a lot of SmallDenseMap issues because we spend a lot of time with fixed stable addresses in the inline buffer. The SmallDenseMap bug fix included makes grow() not double-destroy in some cases. It also fixes a FIXME there, the code was pretty crappy. We now don't have any wasted initialization, but we do move the entries in inline bucket array an extra time. It's probably a better tradeoff, and is much easier to get correct. llvm-svn: 158639
* Introduce a SmallDenseMap container that re-uses the existing DenseMapChandler Carruth2012-06-171-27/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implementation. This type includes an inline bucket array which is used initially. Once it is exceeded, an array of 64 buckets is allocated on the heap. The bucket count grows from there as needed. Some highlights of this implementation: - The inline buffer is very carefully aligned, and so supports types with alignment constraints. - It works hard to avoid aliasing issues. - Supports types with non-trivial constructors, destructors, copy constructions, etc. It works reasonably hard to minimize copies and unnecessary initialization. The most common initialization is to set keys to the empty key, and so that should be fast if at all possible. This class has a performance / space trade-off. It tries to optimize for relatively small maps, and so packs the inline bucket array densely into the object. It will be marginally slower than a normal DenseMap in a few use patterns, so it isn't appropriate everywhere. The unit tests for DenseMap have been generalized a bit to support running over different map implementations in addition to different key/value types. They've then been automatically extended to cover the new container through the magic of GoogleTest's typed tests. All of this is still a bit rough though. I'm going to be cleaning up some aspects of the implementation, documenting things better, and adding tests which include non-trivial types. As soon as I'm comfortable with the correctness, I plan to switch existing users of SmallMap over to this class as it is already more correct w.r.t. construction and destruction of objects iin the map. Thanks to Benjamin Kramer for all the reviews of this and the lead-up patches. That said, more review on this would really be appreciated. As I've noted a few times, I'm quite surprised how hard it is to get the semantics for a hashtable-based map container with a small buffer optimization correct. =] llvm-svn: 158638
* Merge the SmallBitVector and BitVector unit tests with gtest's typed test ↵Benjamin Kramer2012-06-162-212/+25
| | | | | | magic and bring SmallBitVector up to date. llvm-svn: 158600
* Work around a bug with MSVC 10 where it fails to recognize a valid useChandler Carruth2012-06-161-0/+9
| | | | | | | | | of typename. GCC and Clang were fine with this, but MSVC won't accept it. Fortunately, it also doesn't need it. Yuck. Thanks to Nakamura for pointing this out in IRC. llvm-svn: 158593
* Type parameterize the DenseMap unit tests.Chandler Carruth2012-06-161-87/+102
| | | | | | | | | | | | These were already trying to be type parameterized over different key/value pairs. I've realized this goal using GoogleTest's typed test functionality. This allows us to easily replicate the tests across different key/value combinations and soon different mapping templates. I've fixed a few bugs in the tests and extended them a bit in the process as many tests were only applying to the int->int mapping. llvm-svn: 158589
* Fix typos found by http://github.com/lyda/misspell-checkBenjamin Kramer2012-06-021-1/+1
| | | | llvm-svn: 157885
* Remove the PTX back-end and all of its artifacts (triple, etc.)Justin Holewinski2012-05-241-6/+6
| | | | | | | | This back-end was deprecated in favor of the NVPTX back-end. NV_CONTRIB llvm-svn: 157417
* fix the quotient returned by sdivrem() for the case when LHS is negative and ↵Nuno Lopes2012-05-221-0/+28
| | | | | | | | RHS is positive based on a patch by Preston Briggs, with some modifications llvm-svn: 157231
* Remove warning about testing unsigned int with int.Bill Wendling2012-05-151-1/+1
| | | | llvm-svn: 156812
* Fixed one small stupid, but critical bug.Stepan Dyatkovskiy2012-05-151-0/+15
| | | | llvm-svn: 156810
OpenPOWER on IntegriCloud