summaryrefslogtreecommitdiffstats
path: root/llvm/unittests
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "[SetVector] Add erase() method"Jun Bum Lim2016-03-252-35/+0
| | | | | | This reverts commit r264414. llvm-svn: 264420
* Improve StringMap unittests: reintroduce move count, but shield against ↵Mehdi Amini2016-03-251-5/+12
| | | | | | | std::pair internals From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 264418
* Ensure that the StringMap does not grow during the test for ↵Mehdi Amini2016-03-251-0/+3
| | | | | | | pre-allocation/reserve From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 264416
* [SetVector] Add erase() methodJun Bum Lim2016-03-252-0/+35
| | | | | | | | | | | | | | | | | | | | Summary: Add erase() which returns an iterator pointing to the next element after the erased one. This makes it possible to erase selected elements while iterating over the SetVector : while (I != E) if (test(*I)) I = SetVector.erase(I); else ++I; Reviewers: qcolombet, mcrosier, MatzeB, dblaikie Subscribers: dberlin, dblaikie, mcrosier, llvm-commits Differential Revision: http://reviews.llvm.org/D18281 llvm-svn: 264414
* Disable counting the number of move in the unittest, it seems to rely on ↵Mehdi Amini2016-03-252-4/+9
| | | | | | | move-construction elision From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 264412
* Query the StringMap only once when creating MDString (NFC)Mehdi Amini2016-03-251-14/+47
| | | | | | | | | | | | | | | | Summary: Loading IR with debug info improves MDString::get() from 19ms to 10ms. This is a rework of D16597 with adding an "emplace" method on the StringMap to avoid requiring the MDString move ctor to be public. Reviewers: dexonsmith Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D17920 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 264386
* Adjust initial size in StringMap constructor to guarantee no grow()Mehdi Amini2016-03-251-3/+42
| | | | | | | | | | | | | | | | | | Summary: StringMap ctor accepts an initialize size, but expect it to be rounded to the next power of 2. The ctor can handle that directly instead of expecting clients to round it. Also, since the map will resize itself when 75% full, take this into account an initialize a larger initial size to avoid any growth. Reviewers: dblaikie Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D18344 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 264385
* Fix DenseMap::reserve(): the formula was wrongMehdi Amini2016-03-251-7/+118
| | | | | | | | | | | | | | | | | | | | | | Summary: Just running the loop in the unittests for a few more iterations (till 48) exhibit that the condition on the limit was not handled properly in r263522. Rewrite the test to use a class to count move/copies that happens when inserting into the map. Also take the opportunity to refactor the logic to compute the number of buckets required for a given number of entries in the map. Use this when constructing a DenseMap with a desired size given to the constructor (and add a tests for this). Reviewers: dblaikie Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D18345 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 264384
* Try to fix ODR violation of ErrorInfo::IDReid Kleckner2016-03-241-3/+10
| | | | | | This implements my suggestion to Lang. llvm-svn: 264360
* [ADT] C++11ify SmallVector::erase's arguments from iterator to const_iteratorDavid Blaikie2016-03-241-2/+4
| | | | llvm-svn: 264330
* ErrorTest.cpp: Move instantiations out of anonymous namespace. gcc didn't ↵NAKAMURA Takumi2016-03-241-4/+3
| | | | | | complain. llvm-svn: 264297
* Define ErrorInfo::ID explicitly.NAKAMURA Takumi2016-03-241-0/+4
| | | | llvm-svn: 264293
* ErrorTest.cpp: Fix an expression, possibly typo.NAKAMURA Takumi2016-03-241-1/+1
| | | | llvm-svn: 264290
* [Support] Add conversions between Expected<T> and ErrorOr<T>.Lang Hames2016-03-241-1/+24
| | | | | | More utilities to help with std::error_code -> Error transitions. llvm-svn: 264238
* [Support] Make all Errors convertible to std::error_code.Lang Hames2016-03-231-0/+9
| | | | | | | | | | | | This is a temporary crutch to enable code that currently uses std::error_code to be incrementally moved over to Error. Requiring all Error instances be convertible enables clients to call errorToErrorCode on any error (not just ECErrors created by conversion *from* an error_code). This patch also moves code for Error from ErrorHandling.cpp into a new Error.cpp file. llvm-svn: 264221
* APFloat: Fix signalling nans for scalbnMatt Arsenault2016-03-231-1/+16
| | | | llvm-svn: 264219
* StringRef::copy shouldn't allocate anything for length 0 strings.Pete Cooper2016-03-231-0/+9
| | | | | | | | | | | The BumpPtrAllocator currently doesn't handle zero length allocations well. The discussion for how to fix that is ongoing. However, there's no need for StringRef::copy to actually allocate anything here anyway, so just return StringRef() when we get a zero length copy. Reviewed by David Blaikie llvm-svn: 264201
* Add getBlockProfileCount method to BlockFrequencyInfoEaswaran Raman2016-03-232-0/+87
| | | | | | Differential Revision: http://reviews.llvm.org/D18233 llvm-svn: 264179
* [unittests] clang-format a line, NFCVedant Kumar2016-03-221-3/+1
| | | | llvm-svn: 264059
* Fix unittests: resize() -> reserve()Mehdi Amini2016-03-221-1/+1
| | | | | From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 264029
* [Orc] Switch RPC Procedure to take a function type, rather than an arg list.Lang Hames2016-03-211-12/+4
| | | | | | No functional change, just a little more readable. llvm-svn: 263951
* APFloat: Add frexpMatt Arsenault2016-03-211-1/+127
| | | | llvm-svn: 263950
* Implement constant folding for bitreverseMatt Arsenault2016-03-211-0/+42
| | | | llvm-svn: 263945
* Interface to get/set profile summary metadata to moduleEaswaran Raman2016-03-182-0/+27
| | | | | | Differential Revision: http://reviews.llvm.org/D17894 llvm-svn: 263835
* [Support] Refactor Error unit tests to avoid duplicating work.Lang Hames2016-03-181-294/+229
| | | | | | Suggested by Dave Blaikie in review for r263749. Thanks Dave! llvm-svn: 263768
* Revert "allow lambdas in mapped_iterator"Mike Aizatsky2016-03-172-52/+0
| | | | | | | | | | | | | | | MSVC as usual: C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\include\llvm/ADT/STLExtras.h(120): error C2100: illegal indirection C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\include\llvm/IR/Instructions.h(3966): note: see reference to class template instantiation 'llvm::mapped_iterator<llvm::User::op_iterator,llvm::CatchSwitchInst::DerefFnTy>' being compiled This reverts commit e091dd63f1f34e043748e28ad160d3bc17731168. llvm-svn: 263760
* allow lambdas in mapped_iteratorMike Aizatsky2016-03-172-0/+52
| | | | | | Differential Revision: http://reviews.llvm.org/D17311 llvm-svn: 263759
* [Support] Add ExitOnError utility to support tools that use the exit-on-errorLang Hames2016-03-171-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | idiom. Most LLVM tool code exits immediately when an error is encountered and prints an error message to stderr. The ExitOnError class supports this by providing two call operators - one for Errors, and one for Expected<T>s. Calls to code that can return Errors (or Expected<T>s) can use these calls to bail out on error, and otherwise continue as if the operation had succeeded. E.g. Error foo(); Expected<int> bar(); int main(int argc, char *argv[]) { ExitOnError ExitOnErr; ExitOnErr.setBanner(std::string("Error in ") + argv[0] + ":"); // Exit if foo returns an error. No need to manually check error return. ExitOnErr(foo()); // Exit if bar returns an error, otherwise unwrap the contained int and // continue. int X = ExitOnErr(bar()); // ... return 0; } llvm-svn: 263749
* [Support] Make Error::isA<T>() works on success values.Lang Hames2016-03-171-0/+3
| | | | llvm-svn: 263745
* [Support] Update Error unit test to remove implementation specific behaviour.Lang Hames2016-03-161-2/+1
| | | | llvm-svn: 263610
* [Support] Add the 'Error' class for structured error handling.Lang Hames2016-03-162-0/+459
| | | | | | | | | | | | | | | | | This patch introduces the Error classs for lightweight, structured, recoverable error handling. It includes utilities for creating, manipulating and handling errors. The scheme is similar to exceptions, in that errors are described with user-defined types. Unlike exceptions however, errors are represented as ordinary return types in the API (similar to the way std::error_code is used). For usage notes see the LLVM programmer's manual, and the Error.h header. Usage examples can be found in unittests/Support/ErrorTest.cpp. Many thanks to David Blaikie, Mehdi Amini, Kevin Enderby and others on the llvm-dev and llvm-commits lists for lots of discussion and review. llvm-svn: 263609
* DenseMap: make .resize() do the intuitive thingFiona Glaser2016-03-151-0/+13
| | | | | | | | | | | | | | | | | | | In some places, like InstCombine, we resize a DenseMap to fit the elements we intend to put in it, then insert those elements (to avoid continual reallocations as it grows). But .resize(foo) doesn't actually do what people think; it resizes to foo buckets (which is really an implementation detail the user of DenseMap probably shouldn't care about), not the space required to fit foo elements. DenseMap grows if 3/4 of its buckets are full, so this actually causes one forced reallocation every time instead of avoiding a reallocation. This patch makes .resize(foo) do the intuitive thing: it grows to the size necessary to fit foo elements without new allocations. Also include a test to verify that .resize() actually does what we think it does. llvm-svn: 263522
* MathExtrasTest.cpp: Use EXPECT_DOUBLE_EQ here, instead of EXPECT_FLOAT_EQ.NAKAMURA Takumi2016-03-141-1/+1
| | | | llvm-svn: 263508
* Remove code added for debugging purposes. NFC.Easwaran Raman2016-03-141-3/+3
| | | | llvm-svn: 263500
* [ADT] Add a pop_back_val method to the SparseSet container.Quentin Colombet2016-03-141-0/+20
| | | | | | The next commit will use it. llvm-svn: 263455
* Remove some unused variablesDavid Blaikie2016-03-131-5/+4
| | | | llvm-svn: 263396
* Remove PreserveNames template parameter from IRBuilderMehdi Amini2016-03-132-2/+2
| | | | | | | | This reapplies r263258, which was reverted in r263321 because of issues on Clang side. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 263393
* Fixed DIBuilder to verify that same imported entity will not be added twice ↵Amjad Aboud2016-03-131-0/+15
| | | | | | | | to the "imports" list of the DICompileUnit. Differential Revision: http://reviews.llvm.org/D17884 llvm-svn: 263379
* APFloat: Fix ilogb for denormalsMatt Arsenault2016-03-131-2/+16
| | | | llvm-svn: 263370
* APFloat: Fix scalbn handling of denormalsMatt Arsenault2016-03-131-22/+135
| | | | | | | This was incorrect for denormals, and also failed on longer exponent ranges. llvm-svn: 263369
* Temporarily revert:Eric Christopher2016-03-122-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit ae14bf6488e8441f0f6d74f00455555f6f3943ac Author: Mehdi Amini <mehdi.amini@apple.com> Date: Fri Mar 11 17:15:50 2016 +0000 Remove PreserveNames template parameter from IRBuilder Summary: Following r263086, we are now relying on a flag on the Context to discard Value names in release builds. Reviewers: chandlerc Subscribers: mzolotukhin, llvm-commits Differential Revision: http://reviews.llvm.org/D18023 From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263258 91177308-0d34-0410-b5e6-96231b3b80d8 until we can figure out what to do about clang and Release build testing. This reverts commit 263258. llvm-svn: 263321
* [LoopUnroll] Convert some existing tests to unit-tests.Michael Zolotukhin2016-03-121-4/+144
| | | | | | | | | | | | Summary: As we now have unit-tests for UnrollAnalyzer, we can convert some existing tests to this format. It should make the tests more robust. Reviewers: chandlerc, sanjoy Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D17904 llvm-svn: 263318
* Remove PreserveNames template parameter from IRBuilderMehdi Amini2016-03-112-2/+2
| | | | | | | | | | | | | | | Summary: Following r263086, we are now relying on a flag on the Context to discard Value names in release builds. Reviewers: chandlerc Subscribers: mzolotukhin, llvm-commits Differential Revision: http://reviews.llvm.org/D18023 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 263258
* More UTF string conversion wrappersMarianne Mailhot-Sarrasin2016-03-111-1/+36
| | | | | | | | | | | Added new string conversion wrappers that convert between `std::string` (of UTF-8 bytes) and `std::wstring`, which is particularly useful for Win32 interop. Also fixed a missing string conversion for `getenv` on Win32, using these new wrappers. The motivation behind this is to provide the support functions required for LLDB to work properly on Windows with non-ASCII data; however, the functions are not LLDB specific. Patch by cameron314 Differential Revision: http://reviews.llvm.org/D17549 llvm-svn: 263247
* [PM] Make the AnalysisManager parameter to run methods a reference.Chandler Carruth2016-03-113-28/+27
| | | | | | | | | | | | This was originally a pointer to support pass managers which didn't use AnalysisManagers. However, that doesn't realistically come up much and the complexity of supporting it doesn't really make sense. In fact, *many* parts of the pass manager were just assuming the pointer was never null already. This at least makes it much more explicit and clear. llvm-svn: 263219
* [PM] Rename the CRTP mixin base classes for the new pass manager toChandler Carruth2016-03-111-9/+11
| | | | | | | | | | | | | | | | | | | | clarify their purpose. Firstly, call them "...Mixin" types so it is clear that there is no type hierarchy being formed here. Secondly, use the term 'Info' to clarify that they aren't adding any interesting *semantics* to the passes or analyses, just exposing APIs used by the management layer to get information about the pass or analysis. Thanks to Manuel for helping pin down the naming confusion here and come up with effective names to address it. In case you already have some out-of-tree stuff, the following should be roughly what you want to update: perl -pi -e 's/\b(Pass|Analysis)Base\b/\1InfoMixin/g' llvm-svn: 263217
* [PM] Implement the final conclusion as to how the analysis IDs shouldChandler Carruth2016-03-111-0/+10
| | | | | | | | | | | | | | | | | | | | work in the face of the limitations of DLLs and templated static variables. This requires passes that use the AnalysisBase mixin provide a static variable themselves. So as to keep their APIs clean, I've made these private and befriended the CRTP base class (which is the common practice). I've added documentation to AnalysisBase for why this is necessary and at what point we can go back to the much simpler system. This is clearly a better pattern than the extern template as it caught *numerous* places where the template magic hadn't been applied and things were "just working" but would eventually have broken mysteriously. llvm-svn: 263216
* [AsmParser] Expose an API to parse a string starting with a type.Quentin Colombet2016-03-081-0/+143
| | | | | | | | | | | | Without actually parsing a type it is difficult to perdict where the type definition ends. In other words, instead of expecting the user of the parser API to hand over only the relevant bits of the string being parsed, take the whole string, parse the type, and get back the number of characters that have been read. This will be used by the MIR testing infrastructure. llvm-svn: 262884
* [AsmParser] Add a function to parse a standalone type.Quentin Colombet2016-03-071-0/+120
| | | | | | | This is useful for MIR serialization. Indeed generic machine instructions must have a type and we don't want to duplicate the logic in the MIParser. llvm-svn: 262868
* unitests: add some ARM TargetParser testsSaleem Abdulrasool2016-03-062-0/+52
| | | | | | | | | The ARM TargetParser would construct invalid StringRefs. This would cause asserts to trigger. Add some tests in LLVM to ensure that we dont regress on this in the future. Although there is a test for this in clang, this ensures that the changes would get caught in the same repository. llvm-svn: 262790
OpenPOWER on IntegriCloud