summaryrefslogtreecommitdiff
path: root/unittests
Commit message (Collapse)AuthorAge
* raw_ostream: Forward declare OpenFlags and include FileSystem.h only where ↵Benjamin Kramer2014-04-29
| | | | | | necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207593 91177308-0d34-0410-b5e6-96231b3b80d8
* SupportTest: Fix test names harderDuncan P. N. Exon Smith2014-04-29
| | | | | | r207552, r207553 and r207554 all had bad test names. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207560 91177308-0d34-0410-b5e6-96231b3b80d8
* Support: More BlockFrequencyTest => BranchProbabilityTestDuncan P. N. Exon Smith2014-04-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207554 91177308-0d34-0410-b5e6-96231b3b80d8
* Support: Fix test nameDuncan P. N. Exon Smith2014-04-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207553 91177308-0d34-0410-b5e6-96231b3b80d8
* Support: BlockFrequencyTest => BranchProbabilityTestDuncan P. N. Exon Smith2014-04-29
| | | | | | | Move a detailed test of `BranchProbability::scale()` from `BlockFrequencyTest` over to `BranchProbabilityTest`. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207552 91177308-0d34-0410-b5e6-96231b3b80d8
* blockfreq: Defer to BranchProbability::scale() (again)Duncan P. N. Exon Smith2014-04-29
| | | | | | | | | | | | Change `BlockFrequency` to defer to `BranchProbability::scale()` and `BranchProbability::scaleByInverse()`. This removes `BlockFrequency::scale()` from its API (and drops the ability to see the remainder), but the only user was the unit tests. If some code in the future needs an API that exposes the remainder, we can add something to `BranchProbability`, but I find that unlikely. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207550 91177308-0d34-0410-b5e6-96231b3b80d8
* Support: Add BranchProbability::scale() and ::scaleByInverse()Duncan P. N. Exon Smith2014-04-29
| | | | | | | Add API to `BranchProbability` for scaling big integers. Next job is to rip the logic out of `BlockMass` and `BlockFrequency`. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207544 91177308-0d34-0410-b5e6-96231b3b80d8
* Support: Add unit tests for BranchProbabilityDuncan P. N. Exon Smith2014-04-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207540 91177308-0d34-0410-b5e6-96231b3b80d8
* LinkModulesTest.cpp: Reformat.NAKAMURA Takumi2014-04-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207537 91177308-0d34-0410-b5e6-96231b3b80d8
* [CMake] Enable llvm/unittests/LinkerTests. It had not been enabled since ↵NAKAMURA Takumi2014-04-29
| | | | | | r199354. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207536 91177308-0d34-0410-b5e6-96231b3b80d8
* LinkModulesTest.cpp: Use test-specific Ctx instead of getGlobalContext(). ↵NAKAMURA Takumi2014-04-29
| | | | | | The global context might not be free'd. [vg_leak] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207535 91177308-0d34-0410-b5e6-96231b3b80d8
* [ADT] Teach PointerUnion to support assignment directly from nullptr toChandler Carruth2014-04-29
| | | | | | clear it out. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207471 91177308-0d34-0410-b5e6-96231b3b80d8
* [cleanup] Add some actual positive tests for equality. This unittestChandler Carruth2014-04-28
| | | | | | | never actually compared for equality two pointer unions that were equal. Fortunately, things seem to work. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207468 91177308-0d34-0410-b5e6-96231b3b80d8
* [cleanup] Make this test use a proper fixture rather than globals.Chandler Carruth2014-04-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207466 91177308-0d34-0410-b5e6-96231b3b80d8
* [cleanup] Fix the whitespace in this test. Notably, correct spacingChandler Carruth2014-04-28
| | | | | | around pointer types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207465 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Add pass run listeners to the pass manager.Juergen Ributzka2014-04-28
| | | | | | | | | | | | | | | | | | This commit provides the necessary C/C++ APIs and infastructure to enable fine- grain progress report and safe suspension points after each pass in the pass manager. Clients can provide a callback function to the pass manager to call after each pass. This can be used in a variety of ways (progress report, dumping of IR between passes, safe suspension of threads, etc). The run listener list is maintained in the LLVMContext, which allows a multi- threaded client to be only informed for it's own thread. This of course assumes that the client created a LLVMContext for each thread. This fixes <rdar://problem/16728690> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207430 91177308-0d34-0410-b5e6-96231b3b80d8
* [LCG] Add the most basic of edge insertion to the lazy call graph. ThisChandler Carruth2014-04-28
| | | | | | | just handles the pre-DFS case. Also add some test cases for this case to make sure it works. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207411 91177308-0d34-0410-b5e6-96231b3b80d8
* [LCG] Make the return of the IntraSCC removal method actually match itsChandler Carruth2014-04-28
| | | | | | | | contract (and be much more useful). It now provides exactly the post-order traversal a caller might need to perform on newly formed SCCs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207410 91177308-0d34-0410-b5e6-96231b3b80d8
* [LCG] Re-organize the methods for mutating a call graph to make theirChandler Carruth2014-04-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | API requirements much more obvious. The key here is that there are two totally different use cases for mutating the graph. Prior to doing any SCC formation, it is very easy to mutate the graph. There may be users that want to do small tweaks here, and then use the already-built graph for their SCC-based operations. This method remains on the graph itself and is documented carefully as being cheap but unavailable once SCCs are formed. Once SCCs are formed, and there is some in-flight DFS building them, we have to be much more careful in how we mutate the graph. These mutation operations are sunk onto the SCCs themselves, which both simplifies things (the code was already there!) and helps make it obvious that these interfaces are only applicable within that context. The other primary constraint is that the edge being mutated is actually related to the SCC on which we call the method. This helps make it obvious that you cannot arbitrarily mutate some other SCC. I've tried to write much more complete documentation for the interesting mutation API -- intra-SCC edge removal. Currently one aspect of this documentation is a lie (the result list of SCCs) but we also don't even have tests for that API. =[ I'm going to add tests and fix it to match the documentation next. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207339 91177308-0d34-0410-b5e6-96231b3b80d8
* DIE: Pass ownership of children via std::unique_ptr rather than raw pointer.David Blaikie2014-04-25
| | | | | | | | | | | This should reduce the chance of memory leaks like those fixed in r207240. There's still some unclear ownership of DIEs happening in DwarfDebug. Pushing unique_ptr and references through more APIs should help expose the cases where ownership is a bit fuzzy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207263 91177308-0d34-0410-b5e6-96231b3b80d8
* DIEEntry: Refer to the specified DIE via reference rather than pointer.David Blaikie2014-04-25
| | | | | | | Makes some more cases (the unit tests, specifically), lexically compatible with a change to unique_ptr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207261 91177308-0d34-0410-b5e6-96231b3b80d8
* SCC: Change clients to use const, NFCDuncan P. N. Exon Smith2014-04-25
| | | | | | | | | | It's fishy to be changing the `std::vector<>` owned by the iterator, and no one actual does it, so I'm going to remove the ability in a subsequent commit. First, update the users. <rdar://problem/14292693> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207252 91177308-0d34-0410-b5e6-96231b3b80d8
* PR19554: Fix some memory leaks in DIEHashTest.cppDavid Blaikie2014-04-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207240 91177308-0d34-0410-b5e6-96231b3b80d8
* [ADT] Generalize pointee_iterator to smart pointers by using decltype.Chandler Carruth2014-04-24
| | | | | | Based on review feedback from Dave on the original patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207146 91177308-0d34-0410-b5e6-96231b3b80d8
* [LCG] Re-order expectations to provide more useful output when debuggingChandler Carruth2014-04-24
| | | | | | | an issue. This way you see that the number of nodes was wrong before a crash due to accessing too many nodes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207094 91177308-0d34-0410-b5e6-96231b3b80d8
* [LCG] Switch the SCC's parent iterators to be value iterators ratherChandler Carruth2014-04-24
| | | | | | than pointer iterators. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207086 91177308-0d34-0410-b5e6-96231b3b80d8
* [ADT] Add a generic iterator utility for adapting iterators much likeChandler Carruth2014-04-24
| | | | | | | | | | | | | | | | | | | | | | | | | Boost's iterator_adaptor, and a specific adaptor which iterates over pointees when wrapped around an iterator over pointers. This is the result of a long discussion on IRC with Duncan Smith, Dave Blaikie, Richard Smith, and myself. Essentially, I could use some subset of the iterator facade facilities often used from Boost, and everyone seemed interested in having the functionality in a reasonably generic form. I've tried to strike a balance between the pragmatism and the established Boost design. The primary differences are: 1) Delegating to the standard iterator interface names rather than special names that then make up a second iterator-like API. 2) Using the name 'pointee_iterator' which seems more clear than 'indirect_iterator'. The whole business of calling the '*p' operation 'pointer indirection' in the standard is ... quite confusing. And 'dereference' is no better of a term for moving from a pointer to a reference. Hoping Duncan, and others continue to provide comments on this until we've got a nice, minimal abstraction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207069 91177308-0d34-0410-b5e6-96231b3b80d8
* [LCG] Normalize the post-order SCC iterator to just iterate over the SCCChandler Carruth2014-04-23
| | | | | | values rather than having pointers in weird places. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207053 91177308-0d34-0410-b5e6-96231b3b80d8
* [LCG] Switch the primary node iterator to be a *much* more normal C++Chandler Carruth2014-04-23
| | | | | | iterator, returning a Node by reference on dereference. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207048 91177308-0d34-0410-b5e6-96231b3b80d8
* [LCG] Switch the SCC lookup to be in terms of call graph nodes ratherChandler Carruth2014-04-23
| | | | | | | | | | than functions. So far, this access pattern is *much* more common. It seems likely that any user of this interface is going to have nodes at the point that they are querying the SCCs. No functionality changed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207045 91177308-0d34-0410-b5e6-96231b3b80d8
* [LCG] Add the first round of mutation support to the lazy call graph.Chandler Carruth2014-04-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements the core functionality necessary to remove an edge from the call graph and correctly update both the basic graph and the SCC structure. As part of that it has to run a tiny (in number of nodes) Tarjan-style DFS walk of an SCC being mutated to compute newly formed SCCs, etc. This is *very rough* and a WIP. I have a bunch of FIXMEs for code cleanup that will reduce the boilerplate in this change substantially. I also have a bunch of simplifications to various parts of both algorithms that I want to make, but first I'd like to have a more holistic picture. Ideally, I'd also like more testing. I'll probably add quite a few more unit tests as I go here to cover the various different aspects and corner cases of removing edges from the graph. Still, this is, so far, successfully updating the SCC graph in-place without disrupting the identity established for the existing SCCs even when we do challenging things like delete the critical edge that made an SCC cycle at all and have to reform things as a tree of smaller SCCs. Getting this to work is really critical for the new pass manager as it is going to associate significant state with the SCC instance and needs it to be stable. That is also the motivation behind the return of the newly formed SCCs. Eventually, I'll wire this all the way up to the public API so that the pass manager can use it to correctly re-enqueue newly formed SCCs into a fresh postorder traversal. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206968 91177308-0d34-0410-b5e6-96231b3b80d8
* [LCG] Implement Tarjan's algorithm correctly this time. We have to walkChandler Carruth2014-04-23
| | | | | | | | | | | | up the stack finishing the exploration of each entries children before we're finished in addition to accounting for their low-links. Added a unittest that really hammers home the need for this with interlocking cycles that would each appear distinct otherwise and crash or compute the wrong result. As part of this, nuke a stale fixme and bring the rest of the implementation still more closely in line with the original algorithm. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206966 91177308-0d34-0410-b5e6-96231b3b80d8
* [LCG] Add a unittest for the LazyCallGraph. I had a weak moment andChandler Carruth2014-04-23
| | | | | | | | | | | | | | | | | | | | | | | | resisted this for too long. Just with the basic testing here I was able to exercise the analysis in more detail and sift out both type signature bugs in the API and a bug in the DFS numbering. All of these are fixed here as well. The unittests will be much more important for the mutation support where it is necessary to craft minimal mutations and then inspect the state of the graph. There is just no way to do that with a standard FileCheck test. However, unittesting these kinds of analyses is really quite easy, especially as they're designed with the new pass manager where there is essentially no infrastructure required to rig up the core logic and exercise it at an API level. As a minor aside about the DFS numbering bug, the DFS numbering used in LCG is a bit unusual. Rather than numbering from 0, we number from 1, and use 0 as the sentinel "unvisited" state. Other implementations often use '-1' for this, but I find it easier to deal with 0 and it shouldn't make any real difference provided someone doesn't write silly bugs like forgetting to actually initialize the DFS numbering. Oops. ;] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206954 91177308-0d34-0410-b5e6-96231b3b80d8
* This reverts r206828 until David has time to figure out that is going on.Quentin Colombet2014-04-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206839 91177308-0d34-0410-b5e6-96231b3b80d8
* Use unique_ptr to handle ownership of Value*s in Cloning unit tests.David Blaikie2014-04-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206828 91177308-0d34-0410-b5e6-96231b3b80d8
* Make the User::value_op_iterator a random access iterator. I had writtenChandler Carruth2014-04-17
| | | | | | | | | this code ages ago and lost track of it. Seems worth doing though -- this thing can get called from places that would benefit from knowing that std::distance is O(1). Also add a very fledgeling unittest for Users and make sure various aspects of this seem to work reasonably. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206453 91177308-0d34-0410-b5e6-96231b3b80d8
* [Allocator] Make BumpPtrAllocator movable and move assignable.Chandler Carruth2014-04-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206372 91177308-0d34-0410-b5e6-96231b3b80d8
* verify-di: Implement DebugInfoVerifierDuncan P. N. Exon Smith2014-04-15
| | | | | | | | | | | | | | | | | | | | | Implement DebugInfoVerifier, which steals verification relying on DebugInfoFinder from Verifier. - Adds LegacyDebugInfoVerifierPassPass, a ModulePass which wraps DebugInfoVerifier. Uses -verify-di command-line flag. - Change verifyModule() to invoke DebugInfoVerifier as well as Verifier. - Add a call to createDebugInfoVerifierPass() wherever there was a call to createVerifierPass(). This implementation as a module pass should sidestep efficiency issues, allowing us to turn debug info verification back on. <rdar://problem/15500563> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206300 91177308-0d34-0410-b5e6-96231b3b80d8
* [Allocator] Finally, finish nuking the redundant code that led me hereChandler Carruth2014-04-15
| | | | | | | | | | | | | | | | by removing the MallocSlabAllocator entirely and just using MallocAllocator directly. This makes all off these allocators expose and utilize the same core interface. The only ugly part of this is that it exposes the fact that the JIT allocator has no real handling of alignment, any more than the malloc allocator does. =/ It would be nice to fix both of these to support alignments, and then to leverage that in the BumpPtrAllocator to do less over allocation in order to manually align pointers. But, that's another patch for another day. This patch has no functional impact, it just removes the somewhat meaningless wrapper around MallocAllocator. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206267 91177308-0d34-0410-b5e6-96231b3b80d8
* [Allocator] Make the underlying allocator a template instead of anChandler Carruth2014-04-14
| | | | | | | | | | | | abstract interface. The only user of this functionality is the JIT memory manager and it is quite happy to have a custom type here. This removes a virtual function call and a lot of unnecessary abstraction from the common case where this is just a *very* thin vaneer around a call to malloc. Hopefully still no functionality changed here. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206149 91177308-0d34-0410-b5e6-96231b3b80d8
* [Allocator] Switch the BumpPtrAllocator to use a vector of pointers toChandler Carruth2014-04-14
| | | | | | | | | | | | | | | | | | | | | | | slabs rather than embedding a singly linked list in the slabs themselves. This has a few advantages: - Better utilization of the slab's memory by not wasting 16-bytes at the front. - Simpler allocation strategy by not having a struct packed at the front. - Avoids paging every allocated slab in just to traverse them for deallocating or dumping stats. The latter is the really nice part. Folks have complained from time to time bitterly that tearing down a BumpPtrAllocator, even if it doesn't run any destructors, pages in all of the memory allocated. Now it won't. =] Also resolves a FIXME with the scaling of the slab sizes. The scaling now disregards specially sized slabs for allocations larger than the threshold. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206147 91177308-0d34-0410-b5e6-96231b3b80d8
* Retire llvm::array_endof in favor of non-member std::end.Benjamin Kramer2014-04-12
| | | | | | While there make array_lengthof constexpr if we have support for it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206112 91177308-0d34-0410-b5e6-96231b3b80d8
* Move MDBuilder's methods out of line.Benjamin Kramer2014-04-12
| | | | | | | Making them inline was a historical accident, they're neither hot nor templated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206109 91177308-0d34-0410-b5e6-96231b3b80d8
* YAMLIO: Allow scalars to dictate quotation rulesDavid Majnemer2014-04-10
| | | | | | | Introduce ScalarTraits::mustQuote which determines whether or not a StringRef needs quoting before it is acceptable to output. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205955 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Revert "YAMLIO: Encode ambiguous hex strings explicitly""David Majnemer2014-04-09
| | | | | | | | | Don't quote octal compatible strings if they are only two wide, they aren't ambiguous. This reverts commit r205857 which reverted r205857. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205914 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "YAMLIO: Encode ambiguous hex strings explicitly"Filipe Cabecinhas2014-04-09
| | | | | | | | This reverts commit r205839. It broke several tests in lld. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205857 91177308-0d34-0410-b5e6-96231b3b80d8
* YAMLIO: Encode ambiguous hex strings explicitlyDavid Majnemer2014-04-09
| | | | | | | | | | YAMLIO would turn a BinaryRef into the string 0000000004000000. However, the leading zero causes parsers to interpret it as being an octal number instead of a hexadecimal one. Instead, escape such strings as needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205839 91177308-0d34-0410-b5e6-96231b3b80d8
* Changes in IntelJITEventListener - By Arch RobinsonElena Demikhovsky2014-04-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - take->release: LLVM has moved to C++11. MockWrapper became an instance of unique_ptr. - method symbol_iterator::increment disappeared recently, in this revision: r200442 | rafael | 2014-01-29 20:49:50 -0600 (Wed, 29 Jan 2014) | 9 lines Simplify the handling of iterators in ObjectFile. None of the object file formats reported error on iterator increment. In retrospect, that is not too surprising: no object format stores symbols or sections in a linked list or other structure that requires chasing pointers. As a consequence, all error checking can be done on begin() and end(). This reduces the text segment of bin/llvm-readobj in my machine from 521233 to 518526 bytes. My change mimics the change that the revision made to lib/DebugInfo/DWARFContext.cpp . - const_cast: Shut up a warning from gcc. I ran unittests/ExecutionEngine/JIT/Debug+Asserts/JITTests to make sure it worked. - Arch git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205689 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify compression API by compressing into a SmallVector rather than a ↵David Blaikie2014-04-05
| | | | | | | | MemoryBuffer This is the other half of r205676. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205677 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify compression API by decompressing into a SmallVector rather than a ↵David Blaikie2014-04-05
| | | | | | | | | | | | MemoryBuffer This avoids an extra copy during decompression and avoids the use of MemoryBuffer which is a weirdly esoteric device that includes unrelated concepts like "file name" (its rather generic name is a bit misleading). Similar refactoring of zlib::compress coming up. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205676 91177308-0d34-0410-b5e6-96231b3b80d8