summaryrefslogtreecommitdiff
path: root/unittests
Commit message (Collapse)AuthorAge
* Add a unit test for the copy constructor.Rafael Espindola2014-01-09
| | | | | | | | I would not normally add tests like these, but the copy constructor is not used at all in our codebase with c++11, so having this tests might prevent breaking the c++03 build again. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198886 91177308-0d34-0410-b5e6-96231b3b80d8
* Use getError and remove the error_code operator.Rafael Espindola2014-01-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198799 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the LLVM IR asm writer header files into the IR directory, as theyChandler Carruth2014-01-07
| | | | | | | | | | | | | | | | | are part of the core IR library in order to support dumping and other basic functionality. Rename the 'Assembly' include directory to 'AsmParser' to match the library name and the only functionality left their -- printing has been in the core IR library for quite some time. Update all of the #includes to match. All of this started because I wanted to have the layering in good shape before I started adding support for printing LLVM IR using the new pass infrastructure, and commandline support for the new pass infrastructure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198688 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-sort all of the includes with ./utils/sort_includes.py so thatChandler Carruth2014-01-07
| | | | | | | | | | subsequent changes are easier to review. About to fix some layering issues, and wanted to separate out the necessary churn. Also comment and sink the include of "Windows.h" in three .inc files to match the usage in Memory.inc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198685 91177308-0d34-0410-b5e6-96231b3b80d8
* Add in a unittest for the one-use pattern matcher.Chandler Carruth2014-01-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198552 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support to the pattern match library for matching NSW and NUWChandler Carruth2014-01-05
| | | | | | | | | | | instructions. I needed this for a quick experiment I was making, and while I've no idea if that will ever get committed, I didn't want to throw away the pattern match code and for anyone else to have to write it again. I've added unittests to make sure this works correctly. In fun news, this also uncovered the IRBuilder bug. Doh! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198541 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bug in IRBuilder that's been there for who knows how long. ItChandler Carruth2014-01-05
| | | | | | | | failed to correctly propagate the NUW and NSW flags to the constant folder for two instructions. I've added a unittest to cover flag propagation for the rest of the instructions and constant expressions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198538 91177308-0d34-0410-b5e6-96231b3b80d8
* Use a shorter name for the IRBuilder member. This will help the testsChandler Carruth2014-01-05
| | | | | | I'm adding next be a lot more readable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198534 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify the PatternMatch unittest by giving it a module, function, andChandler Carruth2014-01-05
| | | | | | | | | basic block to hold instructions, and managing all of their lifetimes in a fixture. This makes it easy to sink the expectations into the test cases themselves which also makes things a bit more explicit and clearer IMO. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198532 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix break introduced in r198377 due to using a local type as a template ↵David Blaikie2014-01-03
| | | | | | parameter. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198379 91177308-0d34-0410-b5e6-96231b3b80d8
* Test coverage for non-default-constructible elements in a StringMapDavid Blaikie2014-01-02
| | | | | | | | | This functionality was enabled by r198374. Here's a test to ensure it works and we don't regress it. Based on a patch by Maciej Piechotka. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198377 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove StringMapEntryInitializer support.David Blaikie2014-01-02
| | | | | | | It was never specialized so let's just remove that unused configurability and always do the default. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198374 91177308-0d34-0410-b5e6-96231b3b80d8
* Make llvm::Regex non-copyable but movable.David Blaikie2014-01-02
| | | | | | Based on a patch by Maciej Piechotka. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198334 91177308-0d34-0410-b5e6-96231b3b80d8
* Use LLVM_STATIC_ASSERT rather than a hand-rolled implementation.David Blaikie2014-01-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198330 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename 'assert' to something less loaded in CompileAssertHasTypeAlp Toker2014-01-01
| | | | | | Suggested by Aaron Ballman. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198288 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence g++ 4.9 build issue in unit testsAlp Toker2014-01-01
| | | | | | Stopgap measure until we can just use static_assert(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198273 91177308-0d34-0410-b5e6-96231b3b80d8
* Port r198087 and r198089 (strip dead code by default) from make to cmake.Nico Weber2013-12-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198198 91177308-0d34-0410-b5e6-96231b3b80d8
* Attempt to fix JIT unit tests after r198087.Nico Weber2013-12-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198089 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce a simple line-by-line iterator type into the Support library.Chandler Carruth2013-12-27
| | | | | | | | | | | | | | | | | | | This is an iterator which you can build around a MemoryBuffer. It will iterate through the non-empty, non-comment lines of the buffer as a forward iterator. It should be small and reasonably fast (although it could be made much faster if anyone cares, I don't really...). This will be used to more simply support the text-based sample profile file format, and is largely based on the original patch by Diego. I've re-worked the style of it and separated it from the work of producing a MemoryBuffer from a file which both simplifies the interface and makes it easier to test. The style of the API follows the C++ standard naming conventions to fit in better with iterators in general, much like the Path and FileSystem interfaces follow standard-based naming conventions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198068 91177308-0d34-0410-b5e6-96231b3b80d8
* unittests/Support/ProcessTest.cpp: Don't use "windows.h". Use <windows.h> ↵NAKAMURA Takumi2013-12-25
| | | | | | instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198011 91177308-0d34-0410-b5e6-96231b3b80d8
* Makefile.unittest: cleanup may fail. Add '-' in the action.NAKAMURA Takumi2013-12-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197777 91177308-0d34-0410-b5e6-96231b3b80d8
* Make sys::ThreadLocal<> zero-initialized on non-thread builds (PR18205)Hans Wennborg2013-12-19
| | | | | | | | | | | | | According to the docs, ThreadLocal<>::get() should return NULL if no object has been set. This patch makes that the case also for non-thread builds and adds a very basic unit test to check it. (This was causing PR18205 because PrettyStackTraceHead didn't get zero- initialized and we'd crash trying to read past the end of that list. We didn't notice this so much on Linux since we'd crash after printing all the entries, but on Mac we print into a SmallString, and would crash before printing that.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197718 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce clean-ups in llvm/unittests/Makefile.unittest, to sweep stray *Tests.NAKAMURA Takumi2013-12-19
| | | | | | | | | Stray *Tests might stay after reverting. FIXME: Could we apply this feature to clang/unittests? FIXME: Implement this feature to CMake. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197661 91177308-0d34-0410-b5e6-96231b3b80d8
* No point in having a "#if 0"ed unittest.Rafael Espindola2013-12-19
| | | | | | | It is also not clear what the value of the test was. The API is used from existing tools and can (and is) tested with lit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197654 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a buffer overrun detected by AddressSanitizer.Anna Zaks2013-12-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197647 91177308-0d34-0410-b5e6-96231b3b80d8
* ArchiveFileDescriptorTests: Fix CMake build. Each unit test is expected to ↵NAKAMURA Takumi2013-12-19
| | | | | | have suffix "*Tests" for lit gtest runner to seek one. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197636 91177308-0d34-0410-b5e6-96231b3b80d8
* ArchiveFileDescriptorTests: Resurrect part of r197600, but make it ↵NAKAMURA Takumi2013-12-19
| | | | | | | | invalidated, to appease buildbots. Please revert this several hours later ;) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197635 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r197600 while I sort out why it's failing on Windows.Owen Anderson2013-12-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197602 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a unit test for loading an object file via a file descriptor. Patch by ↵Owen Anderson2013-12-18
| | | | | | Pete Cooper. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197600 91177308-0d34-0410-b5e6-96231b3b80d8
* [block-freq] Add a right shift to BlockFrequency that saturates at 1.Michael Gottesman2013-12-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197302 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove APInt::extractBit since it is already implemented via operator[]. ↵Michael Gottesman2013-12-13
| | | | | | Change tests for extractBit to test operator[]. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197277 91177308-0d34-0410-b5e6-96231b3b80d8
* [block-freq] Add the method APInt::nearestLogBase2().Michael Gottesman2013-12-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197272 91177308-0d34-0410-b5e6-96231b3b80d8
* [block-freq] Add the APInt method extractBit.Michael Gottesman2013-12-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197271 91177308-0d34-0410-b5e6-96231b3b80d8
* Use a: and s: instead of a0: and s0: in the DataLayout strings.Rafael Espindola2013-12-13
| | | | | | They are equivalent and the size of 'a' and 's' is unused. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197259 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove some dead codeRichard Barton2013-12-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197144 91177308-0d34-0410-b5e6-96231b3b80d8
* Swap around EXPECT_EQ() arguments orders for more natural gtest Failure messagesAlp Toker2013-12-12
| | | | | | | | | Somewhat counterintuitively the first arg in gtest is treated as the expectation. No change to the tests themselves. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197124 91177308-0d34-0410-b5e6-96231b3b80d8
* Add missing escape characters to the new Regex::escape() functionAlp Toker2013-12-12
| | | | | | | | | The old AddFixedStringToRegEx() it was based on got away with this for the longest time, but the problem became easy to spot after the cleanup in r197096. Also add a quick unit test to cover regex escaping. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197121 91177308-0d34-0410-b5e6-96231b3b80d8
* Darwin: update default iOS version to 5.0Tim Northover2013-12-10
| | | | | | | | | | | | Defaulting to iOS 3.0 when LLVM has to guess the version is no longer a useful option and can give surprising results (like tail calls being disabled). 5.0 seems like a reasonable compromise as a platform that's still interesting to some people. rdar://problem/15567348 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196912 91177308-0d34-0410-b5e6-96231b3b80d8
* [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt.NAKAMURA Takumi2013-12-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196908 91177308-0d34-0410-b5e6-96231b3b80d8
* Add JIT to LINK_COMPONENTS in MCJITTests/Makefile.NAKAMURA Takumi2013-12-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196907 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] rewrite asan's stack frame layoutKostya Serebryany2013-12-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Rewrite asan's stack frame layout. First, most of the stack layout logic is moved into a separte file to make it more testable and (potentially) useful for other projects. Second, make the frames more compact by using adaptive redzones (smaller for small objects, larger for large objects). Third, try to minimized gaps due to large alignments (this is hypothetical since today we don't see many stack vars aligned by more than 32). The frames indeed become more compact, but I'll still need to run more benchmarks before committing, but I am sking for review now to get early feedback. This change will be accompanied by a trivial change in compiler-rt tests to match the new frame sizes. Reviewers: samsonov, dvyukov Reviewed By: samsonov CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2324 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196568 91177308-0d34-0410-b5e6-96231b3b80d8
* Use present fast-math flags when applicable in CreateBinOpMichael Ilseman2013-12-05
| | | | | | | | | | We were previously not adding fast-math flags through CreateBinOp() when it happened to be making a floating point binary operator. This patch updates it to do so similarly to directly calling CreateF*(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196438 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix dominator descendants for unreachable blocks.Diego Novillo2013-12-02
| | | | | | | | | | | | | When a block is unreachable, asking its dom tree descendants should return the empty set. However, the computation of the descendants was causing a segmentation fault because the dom tree node we get from the basic block is initially NULL. Fixed by adding a test for a valid dom tree node before we iterate. The patch also adds some unit tests to the existing dom tree tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196099 91177308-0d34-0410-b5e6-96231b3b80d8
* [CMake] Also OptionTests can be free from add_dependencies() with ↵NAKAMURA Takumi2013-11-28
| | | | | | add_public_tablegen_target(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195928 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Split the CallGraph out from the ModulePass which creates theChandler Carruth2013-11-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CallGraph. This makes the CallGraph a totally generic analysis object that is the container for the graph data structure and the primary interface for querying and manipulating it. The pass logic is separated into its own class. For compatibility reasons, the pass provides wrapper methods for most of the methods on CallGraph -- they all just forward. This will allow the new pass manager infrastructure to provide its own analysis pass that constructs the same CallGraph object and makes it available. The idea is that in the new pass manager, the analysis pass's 'run' method returns a concrete analysis 'result'. Here, that result is a 'CallGraph'. The 'run' method will typically do only minimal work, deferring much of the work into the implementation of the result object in order to be lazy about computing things, but when (like DomTree) there is *some* up-front computation, the analysis does it prior to handing the result back to the querying pass. I know some of this is fairly ugly. I'm happy to change it around if folks can suggest a cleaner interim state, but there is going to be some amount of unavoidable ugliness during the transition period. The good thing is that this is very limited and will naturally go away when the old pass infrastructure goes away. It won't hang around to bother us later. Next up is the initial new-PM-style call graph analysis. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195722 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Complete the cross-layer interfaces with a Module-to-FunctionChandler Carruth2013-11-23
| | | | | | | | | | | | | proxy. This lets a function pass query a module analysis manager. However, the interface is const to indicate that only cached results can be safely queried. With this, I think the new pass manager is largely functionally complete for modules and analyses. Still lots to test, and need to generalize to SCCs and Loops, and need to build an adaptor layer to support the use of existing Pass objects in the new managers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195538 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Rename TestAnalysisPass to TestFunctionAnalysis to clear the wayChandler Carruth2013-11-23
| | | | | | for a TestModuleAnalysis. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195537 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Add support to the analysis managers to query explicitly for cachedChandler Carruth2013-11-23
| | | | | | | | | | | results. This is the last piece of infrastructure needed to effectively support querying *up* the analysis layers. The next step will be to introduce a proxy which provides access to those layers with appropriate use of const to direct queries to the safe interface. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195525 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Switch the downward invalidation to be incremental where only theChandler Carruth2013-11-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | one function's analyses are invalidated at a time. Also switch the preservation of the proxy to *fully* preserve the lower (function) analyses. Combined, this gets both upward and downward analysis invalidation to a point I'm happy with: - A function pass invalidates its function analyses, and its parent's module analyses. - A module pass invalidates all of its functions' analyses including the set of which functions are in the module. - A function pass can preserve a module analysis pass. - If all function passes preserve a module analysis pass, that preservation persists. If any doesn't the module analysis is invalidated. - A module pass can opt into managing *all* function analysis invalidation itself or *none*. - The conservative default is none, and the proxy takes the maximally conservative approach that works even if the set of functions has changed. - If a module pass opts into managing function analysis invalidation it has to propagate the invalidation itself, the proxy just does nothing. The only thing really missing is a way to query for a cached analysis or nothing at all. With this, function passes can more safely request a cached module analysis pass without fear of it accidentally running part way through. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195519 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Teach the analysis managers to pass themselves as arguments to theChandler Carruth2013-11-22
| | | | | | | | | | | | | | run methods of the analysis passes. Also generalizes and re-uses the SFINAE for transformation passes so that users can write an analysis pass and only accept an analysis manager if that is useful to their pass. This completes the plumbing to make an analysis manager available through every pass's run method if desired so that passes no longer need to be constructed around them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195451 91177308-0d34-0410-b5e6-96231b3b80d8