summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT
Commit message (Collapse)AuthorAgeFilesLines
...
* [APFloat] Switch from (PPCDoubleDoubleImpl, IEEEdouble) layout to ↵Tim Shen2017-01-231-17/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (IEEEdouble, IEEEdouble) Summary: This patch changes the layout of DoubleAPFloat, and adjust all operations to do either: 1) (IEEEdouble, IEEEdouble) -> (uint64_t, uint64_t) -> PPCDoubleDoubleImpl, then run the old algorithm. 2) Do the right thing directly. 1) includes multiply, divide, remainder, mod, fusedMultiplyAdd, roundToIntegral, convertFromString, next, convertToInteger, convertFromAPInt, convertFromSignExtendedInteger, convertFromZeroExtendedInteger, convertToHexString, toString, getExactInverse. 2) includes makeZero, makeLargest, makeSmallest, makeSmallestNormalized, compare, bitwiseIsEqual, bitcastToAPInt, isDenormal, isSmallest, isLargest, isInteger, ilogb, scalbn, frexp, hash_value, Profile. I could split this into two patches, e.g. use 1) for all operatoins first, then incrementally change some of them to 2). I didn't do that, because 1) involves code that converts data between PPCDoubleDoubleImpl and (IEEEdouble, IEEEdouble) back and forth, and may pessimize the compiler. Instead, I find easy functions and use approach 2) for them directly. Next step is to implement move multiply and divide from 1) to 2). I don't have plans for other functions in 1). Differential Revision: https://reviews.llvm.org/D27872 llvm-svn: 292839
* Add unittests for empty bitvectors.Matthias Braun2017-01-231-0/+37
| | | | | | Addendum to r292575 llvm-svn: 292817
* [ADT] Add SparseBitVector::find_last().Zachary Turner2017-01-171-0/+39
| | | | | | Differential Revision: https://reviews.llvm.org/D28817 llvm-svn: 292288
* [WebAssembly] Add triple support for the new wasm object formatDan Gohman2017-01-171-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D26701 llvm-svn: 292252
* [APFloatTest] Add tests for various operationsTim Shen2017-01-051-4/+271
| | | | | | Differential Revision: https://reviews.llvm.org/D27833 llvm-svn: 291189
* [ADT] Attempt to fix GCC warning in IntrusiveRefCntPtrTest.Justin Lebar2017-01-041-1/+3
| | | | | | | Our copy constructor doesn't explicitly invoke the base class's constructor, and GCC is (rightly) concerned. llvm-svn: 291023
* [ADT] Speculative attempt to fix build bot issues with r290952.Chandler Carruth2017-01-041-0/+8
| | | | | | | | | | | | This just removes the usage of llvm::reverse and llvm::seq. That makes it harder to handle the empty case correctly and so I've also added a test there. This is just a shot in the dark at what might be behind the buildbot failures. I can't reproduce any issues locally including with ASan... I feel like I'm missing something... llvm-svn: 290954
* [ADT] Enhance the PriorityWorklist to support bulk insertion.Chandler Carruth2017-01-041-0/+39
| | | | | | | | | | | This is both convenient and more efficient as we can skip any intermediate reallocation of the vector. This usage pattern came up in a subsequent patch on the pass manager, but it seems generically useful so I factored it out and added unittests here. llvm-svn: 290952
* [ADT] Fix for compilation error when operator++(int) (post-increment ↵Abhilash Bhandari2016-12-301-0/+13
| | | | | | | | | | | | | | function) of SmallPtrSetIterator is used. The bug was introduced in r289619. Reviewers: Mehdi Amini Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D28134 llvm-svn: 290749
* [ADT] Delete RefCountedBaseVPTR.Justin Lebar2016-12-291-19/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This class is unnecessary. Its comment indicated that it was a compile error to allocate an instance of a class that inherits from RefCountedBaseVPTR on the stack. This may have been true at one point, but it's not today. Moreover you really do not want to allocate *any* refcounted object on the stack, vptrs or not, so if we did have a way to prevent these objects from being stack-allocated, we'd want to apply it to regular RefCountedBase too, obviating the need for a separate RefCountedBaseVPTR class. It seems that the main way RefCountedBaseVPTR provides safety is by making its subclass's destructor virtual. This may have been helpful at one point, but these days clang will emit an error if you define a class with virtual functions that inherits from RefCountedBase but doesn't have a virtual destructor. Reviewers: compnerd, dblaikie Subscribers: cfe-commits, klimek, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D28162 llvm-svn: 290717
* [ADT] Add an llvm::erase_if utility to make the standard erase+remove_ifChandler Carruth2016-12-261-0/+11
| | | | | | | | pattern easier to write. Differential Revision: https://reviews.llvm.org/D28120 llvm-svn: 290555
* [ADT] Add a boring std::partition wrapper similar to our std::remove_ifChandler Carruth2016-12-261-0/+21
| | | | | | wrapper. llvm-svn: 290553
* [ADT] Add a generic concatenating iterator and range (take 2).Chandler Carruth2016-12-251-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | This recommits r290512 that was reverted when MSVC failed to compile it. Since then I've played with various approaches using rextester.com (where I was able to reproduce the failure) and think that I have a solution thanks in part to the help of Dave Blaikie! It seems MSVC just has a defective `decltype` in this version. Manually writing out the type seems to do the trick, even though it is .... quite complicated. Original commit message: This allows both defining convenience iterator/range accessors on types which walk across N different independent ranges within the object, and more direct and simple usages with range based for loops such as shown in the unittest. The same facilities are used for both. They end up quite small and simple as it happens. I've also switched an iterator on `Module` to use this. I would like to add another convenience iterator that includes even more sequences as part of it and seeing this one already present motivated me to actually abstract it away and introduce a general utility. Differential Revision: https://reviews.llvm.org/D28093 llvm-svn: 290528
* Revert r290512: [ADT] Add a generic concatenating iterator and range.Chandler Carruth2016-12-251-23/+0
| | | | | | | | This code doesn't work on MSVC for reasons that elude me and I've not yet covinced a workaround to compile cleanly so reverting for now while I play with it. llvm-svn: 290513
* [ADT] Add a generic concatenating iterator and range.Chandler Carruth2016-12-251-0/+23
| | | | | | | | | | | | | | | | | This allows both defining convenience iterator/range accessors on types which walk across N different independent ranges within the object, and more direct and simple usages with range based for loops such as shown in the unittest. The same facilities are used for both. They end up quite small and simple as it happens. I've also switched an iterator on `Module` to use this. I would like to add another convenience iterator that includes even more sequences as part of it and seeing this one already present motivated me to actually abstract it away and introduce a general utility. Differential Revision: https://reviews.llvm.org/D28093 llvm-svn: 290512
* Fix compilation.Evgeniy Stepanov2016-12-171-1/+1
| | | | | | | unittests/ADT/TwineTest.cpp:106:38: error: field 'Count' will be initialized after base 'llvm::FormatAdapter<int>' [-Werror,-Wreorder] explicit formatter(int &Count) : Count(Count), FormatAdapter(0) {} llvm-svn: 290029
* Add support for formatv to llvm::Twine.Zachary Turner2016-12-171-1/+27
| | | | | | Differential Revision: https://reviews.llvm.org/D27835 llvm-svn: 290020
* [APFloatTest] Log when test fails. NFCTim Shen2016-12-161-7/+21
| | | | | | | | | | Reviewers: iteratee Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D27828 llvm-svn: 289904
* Adapt to recent APFloat changeStephan Bergmann2016-12-141-6/+6
| | | | llvm-svn: 289649
* Replace APFloatBase static fltSemantics data members with getter functionsStephan Bergmann2016-12-141-820/+820
| | | | | | | | | | | | | At least the plugin used by the LibreOffice build (<https://wiki.documentfoundation.org/Development/Clang_plugins>) indirectly uses those members (through inline functions in LLVM/Clang include files in turn using them), but they are not exported by utils/extract_symbols.py on Windows, and accessing data across DLL/EXE boundaries on Windows is generally problematic. Differential Revision: https://reviews.llvm.org/D26671 llvm-svn: 289647
* [llvm] Iterate SmallPtrSet in reverse order to uncover non-determinism in ↵Mandeep Singh Grang2016-12-142-0/+40
| | | | | | | | | | | | | | | | | | codegen Summary: Given a flag (-mllvm -reverse-iterate) this patch will enable iteration of SmallPtrSet in reverse order. The idea is to compile the same source with and without this flag and expect the code to not change. If there is a difference in codegen then it would mean that the codegen is sensitive to the iteration order of SmallPtrSet. This is enabled only with LLVM_ENABLE_ABI_BREAKING_CHECKS. Reviewers: chandlerc, dexonsmith, mehdi_amini Subscribers: mgorny, emaste, llvm-commits Differential Revision: https://reviews.llvm.org/D26718 llvm-svn: 289619
* [ADT] Add llvm::StringLiteral.Zachary Turner2016-12-131-0/+6
| | | | | | | | | | | StringLiteral is a wrapper around a string literal useful for replacing global tables of char arrays with global tables of StringRefs that can initialized in a constexpr context, avoiding the invocation of a global constructor. Differential Revision: https://reviews.llvm.org/D27686 llvm-svn: 289551
* [APFloatTest] Use std::make_tuple to make GCC 4.8 happyTim Shen2016-12-121-35/+38
| | | | | | Differential Revision: https://reviews.llvm.org/D26817 llvm-svn: 289474
* [APFloat] Implement PPCDoubleDouble add and subtract.Tim Shen2016-12-121-16/+119
| | | | | | | | | | | | Summary: I looked at libgcc's implementation (which is based on the paper, Software for Doubled-Precision Floating-Point Computations", by Seppo Linnainmaa, ACM TOMS vol 7 no 3, September 1981, pages 272-283.) and made it generic to arbitrary IEEE floats. Differential Revision: https://reviews.llvm.org/D26817 llvm-svn: 289472
* [stl-extras] Provide an adaptor of std::count for ranges.Michael Gottesman2016-12-041-0/+17
| | | | llvm-svn: 288619
* Add some searching functions for ArrayRef<T>.Zachary Turner2016-11-221-0/+44
| | | | | | Differential Revision: https://reviews.llvm.org/D26999 llvm-svn: 287722
* [ADT] Add initializer list support to SmallPtrSet so that sets can beChandler Carruth2016-11-221-4/+10
| | | | | | easily initialized with some initial values. llvm-svn: 287610
* [Support] Add StringRef::find_lower and contains_lower.Zachary Turner2016-11-121-15/+61
| | | | | | Differential Revision: https://reviews.llvm.org/D25299 llvm-svn: 286724
* Add tests for r286139.Jordan Rose2016-11-071-0/+36
| | | | llvm-svn: 286141
* [APFloat] Make functions that produce APFloaat objects use correct semantics.Tim Shen2016-11-061-0/+28
| | | | | | | | | | | | | | | | | Summary: Fixes PR30869. In D25977 I meant to change all functions that care about lifetime. I changed constructors, factory functions, but I missed member/free functions that return new instances. This patch changes them. Reviewers: hfinkel, kbarton, echristo, joerg Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D26269 llvm-svn: 286060
* [ADT] IntervalMap: fix setStart and setStopMichael LeMay2016-11-031-0/+47
| | | | | | | | | | | | | | | | Summary: These functions currently require that the new closed interval has a length of at least 2. They also currently permit empty half-open intervals. This patch defines nonEmpty in each traits structure and uses it to correct the implementations of setStart and setStop. Reviewers: stoklund, chandlerc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D26064 llvm-svn: 285957
* [ilist_node] Add a getReverseIterator() method and a unittest for it.Michael Gottesman2016-11-021-0/+17
| | | | | | This is the reverse_iterator analogue of getIterator(). llvm-svn: 285780
* [RISCV] Recognise riscv32 and riscv64 in triple parsing codeAlex Bradbury2016-11-011-0/+36
| | | | | | | | | | | This is the first in a series of 10 initial patches that incrementally add an MC layer for RISC-V to LLVM. See <http://lists.llvm.org/pipermail/llvm-dev/2016-August/103748.html> for more discussion. Differential Revision: https://reviews.llvm.org/D23557 llvm-svn: 285707
* [unittests] STLExtrasTest: Remove an MSVC 2013 workaround, NFCI.Vedant Kumar2016-10-251-2/+1
| | | | | | Let's see what the bots have to say about this... llvm-svn: 285091
* [ADT] Zip range adapterMehdi Amini2016-10-191-0/+63
| | | | | | | | | | | | | | | This augments the STLExtras toolset with a zip iterator and range adapter. Zip comes in two varieties: `zip`, which will zip to the shortest of the input ranges, and `zip_first`, which limits its `begin() == end()` checks to just the first range. Recommit r284035 after MSVC2013 support has been dropped. Patch by: Bryant Wong <github.com/bryant> Differential Revision: https://reviews.llvm.org/D23252 llvm-svn: 284623
* [ADT] Remove CachedHash<T>.Justin Lebar2016-10-181-49/+0
| | | | | | | | Nobody is using it. Differential Revision: https://reviews.llvm.org/D25630 llvm-svn: 284503
* [ADT] Add an initializer_list constructor to {Small,}DenseSet.Justin Lebar2016-10-171-0/+15
| | | | | | | | | | Reviewers: timshen Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25629 llvm-svn: 284433
* [ADT] Add SmallDenseSet.Justin Lebar2016-10-171-1/+5
| | | | | | | | | | | | Summary: This matches SmallDenseMap. Reviewers: timshen Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25628 llvm-svn: 284432
* PR30711: Fix incorrect profiling of 'long long' in FoldingSet, then use it toRichard Smith2016-10-161-0/+21
| | | | | | fix TBAA violation in profiling of pointers. llvm-svn: 284336
* Define "contiki" OS specifier.David L Kreitzer2016-10-141-0/+6
| | | | | | | | Patch by Michael LeMay Differential revision: http://reviews.llvm.org/D24897 llvm-svn: 284240
* Revert "[ADT] Zip range adapter"Mehdi Amini2016-10-121-63/+0
| | | | | | This reverts commit r284035, which breaks with MSVC 2013. llvm-svn: 284037
* [ADT] Zip range adapterMehdi Amini2016-10-121-0/+63
| | | | | | | | | | | | | This augments the STLExtras toolset with a zip iterator and range adapter. Zip comes in two varieties: `zip`, which will zip to the shortest of the input ranges, and `zip_first`, which limits its `begin() == end()` checks to just the first krange. Patch by: Bryant Wong <github.com/bryant> Differential Revision: https://reviews.llvm.org/D23252 llvm-svn: 284035
* Re-apply "Disallow ArrayRef assignment from temporaries."Jordan Rose2016-10-111-0/+28
| | | | | | | | | | This re-applies r283798, disabled in r283803, with the static_assert tests disabled under MSVC. The deleted functions still seem to catch mistakes in MSVC, so it's not a significant loss. Part of rdar://problem/16375365 llvm-svn: 283935
* Revert "Disallow ArrayRef assignment from temporaries."Zachary Turner2016-10-101-23/+0
| | | | | | | | | | | This reverts commit r283798, as it causes static asserts on MSVC 2015 with the following errors: ArrayRefTest.cpp(38): error C2338: Assigning from single prvalue element ArrayRefTest.cpp(41): error C2338: Assigning from single xvalue element ArrayRefTest.cpp(47): error C2338: Assigning from an initializer list llvm-svn: 283803
* Rename llvm::apply -> llvm::apply_tuple.Zachary Turner2016-10-101-3/+3
| | | | | | | | | | | llvm::cl already has a function called llvm::apply() so this is causing an ODR violation. The STLExtras version should win the vote on which one gets to be called apply() since it is named after the equivalent STL function, but since renaiming the cl version is more difficult, let's do this for now to get the bots green. llvm-svn: 283800
* Disallow ArrayRef assignment from temporaries.Jordan Rose2016-10-101-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | Without this, the following statements will create ArrayRefs that refer to temporary storage that goes out of scope by the end of the line: someArrayRef = getSingleElement(); someArrayRef = {elem1, elem2}; Note that the constructor still has this problem: ArrayRef<Element> someArrayRef = getSingleElement(); ArrayRef<Element> someArrayRef = {elem1, elem2}; but that's a little harder to get rid of because we want to be able to use this in calls: takesArrayRef(getSingleElement()); takesArrayRef({elem1, elem2}); Part of rdar://problem/16375365. Reviewed by Duncan Exon Smith. llvm-svn: 283798
* [ADT] Don't use make_pointee_iterator in IteratorTest.Justin Lebar2016-10-101-25/+20
| | | | llvm-svn: 283794
* Add llvm::apply to STLExtras.Zachary Turner2016-10-101-0/+45
| | | | | | | | | This is equivalent to the C++14 std::apply(). Since we are not using C++14 yet, this allows us to still make use of apply anyway. Differential revision: https://reviews.llvm.org/D25100 llvm-svn: 283779
* [ADT] Add make_pointe{e,r}_iterator.Justin Lebar2016-10-101-20/+25
| | | | | | | | | | Reviewers: timshen Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25418 llvm-svn: 283765
* [ADT] Let MapVector handle non-copyable values.Justin Lebar2016-10-101-0/+18
| | | | | | | | | | | | Summary: The keys must still be copyable, because we store two copies of them. Reviewers: timshen Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25404 llvm-svn: 283764
OpenPOWER on IntegriCloud