summaryrefslogtreecommitdiff
path: root/unittests
Commit message (Collapse)AuthorAge
* Give unit test its own LLVMContext so MDNodes aren't leaked even if we never ↵Benjamin Kramer2013-11-15
| | | | | | | | call llvm_shutdown. Found by valgrind. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194797 91177308-0d34-0410-b5e6-96231b3b80d8
* Add addrspacecast instruction.Matt Arsenault2013-11-15
| | | | | | Patch by Michele Scandale! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194760 91177308-0d34-0410-b5e6-96231b3b80d8
* Recognize 0x0000 as a COFF file magic.Rui Ueyama2013-11-14
| | | | | | | | | | | | | | | Summary: Some machine-type-neutral object files containing only undefined symbols actually do exist in the Windows standard library. Need to recognize them as COFF files. Reviewers: Bigcheese CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2164 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194734 91177308-0d34-0410-b5e6-96231b3b80d8
* remove extra semicolonNick Kledzik2013-11-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194658 91177308-0d34-0410-b5e6-96231b3b80d8
* Add dyn_cast<> support to YAML I/O's IO classNick Kledzik2013-11-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194655 91177308-0d34-0410-b5e6-96231b3b80d8
* Add simple support for tags in YAML I/ONick Kledzik2013-11-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194644 91177308-0d34-0410-b5e6-96231b3b80d8
* Path: Add tests for existing file magics.Rui Ueyama2013-11-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194607 91177308-0d34-0410-b5e6-96231b3b80d8
* Whitespace.Rui Ueyama2013-11-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194605 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a null pointer dereference when copying a null polymorphic pointer.Chandler Carruth2013-11-13
| | | | | | | | This bug only bit the C++98 build bots because all of the actual uses really do move. ;] But not *quite* ready to do the whole C++11 switch yet, so clean it up. Also add a unit test that catches this immediately. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194548 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce an AnalysisManager which is like a pass manager but with a lotChandler Carruth2013-11-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | more smarts in it. This is where most of the interesting logic that used to live in the implicit-scheduling-hackery of the old pass manager will live. Like the previous commits, note that this is a very early prototype! I expect substantial changes before this is ready to use. The core of the design is the following: - We have an AnalysisManager which can be used across a series of passes over a module. - The code setting up a pass pipeline registers the analyses available with the manager. - Individual transform passes can check than an analysis manager provides the analyses they require in order to fail-fast. - There is *no* implicit registration or scheduling. - Analysis passes are different from other passes: they produce an analysis result that is cached and made available via the analysis manager. - Cached results are invalidated automatically by the pass managers. - When a transform pass requests an analysis result, either the analysis is run to produce the result or a cached result is provided. There are a few aspects of this design that I *know* will change in subsequent commits: - Currently there is no "preservation" system, that needs to be added. - All of the analysis management should move up to the analysis library. - The analysis management needs to support at least SCC passes. Maybe loop passes. Living in the analysis library will facilitate this. - Need support for analyses which are *both* module and function passes. - Need support for pro-actively running module analyses to have cached results within a function pass manager. - Need a clear design for "immutable" passes. - Need support for requesting cached results when available and not re-running the pass even if that would be necessary. - Need more thorough testing of all of this infrastructure. There are other aspects that I view as open questions I'm hoping to resolve as I iterate a bit on the infrastructure, and especially as I start writing actual passes against this. - Should we have separate management layers for function, module, and SCC analyses? I think "yes", but I'm not yet ready to switch the code. Adding SCC support will likely resolve this definitively. - How should the 'require' functionality work? Should *that* be the only way to request results to ensure that passes always require things? - How should preservation work? - Probably some other things I'm forgetting. =] Look forward to more patches in shorter order now that this is in place. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194538 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Start sketching out the new module and function pass manager.Chandler Carruth2013-11-09
| | | | | | | | | | | | | | | | | | This is still just a skeleton. I'm trying to pull together the experimentation I've done into committable chunks, and this is the first coherent one. Others will follow in hopefully short order that move this more toward a useful initial implementation. I still expect the design to continue evolving in small ways as I work through the different requirements and features needed here though. Keep in mind, all of this is off by default. Currently, this mostly exercises the use of a polymorphic smart pointer and templates to hide the polymorphism for the pass manager from the pass implementation. The next step will be more significant, adding the first framework of analysis support. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194325 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the old pass manager infrastructure into a legacy namespace andChandler Carruth2013-11-09
| | | | | | | | | | | | | | | | | | | give the files a legacy prefix in the right directory. Use forwarding headers in the old locations to paper over the name change for most clients during the transitional period. No functionality changed here! This is just clearing some space to reduce renaming churn later on with a new system. Even when the new stuff starts to go in, it is going to be hidden behind a flag and off-by-default as it is still WIP and under development. This patch is specifically designed so that very little out-of-tree code has to change. I'm going to work as hard as I can to keep that the case. Only direct forward declarations of the PassManager class are impacted by this change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194324 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch to allow implicit construction. In many cases, we're wrappingChandler Carruth2013-11-09
| | | | | | a derived type and this makes it *much* easier to write this code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194321 91177308-0d34-0410-b5e6-96231b3b80d8
* Test the polymorphic behavior of this utility.Chandler Carruth2013-11-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194320 91177308-0d34-0410-b5e6-96231b3b80d8
* Use something really explicit to test "move semantics" on builds withoutChandler Carruth2013-11-09
| | | | | | | | | r-value references. I still want to test that when we have them, llvm_move is actually a move. Have I mentioned that I really want to move to C++11? ;] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194318 91177308-0d34-0410-b5e6-96231b3b80d8
* Add the critically missing 'clone' method. =]Chandler Carruth2013-11-09
| | | | | | | | | | Clang managed to never instantiate the copy constructor. Added tests to ensure this path is tested. We could still use tests for the polymorphic nature. Those coming up next. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194317 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the test type out of the function and into the anonymous namespaceChandler Carruth2013-11-09
| | | | | | to fix C++98 builds. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194316 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a polymorphic_ptr<T> smart pointer data type. It's a somewhat sillyChandler Carruth2013-11-09
| | | | | | | | | | | | unique ownership smart pointer which is *deep* copyable by assuming it can call a T::clone() method to allocate a copy of the owned data. This is mostly useful with containers or other collections of uniquely owned data in C++98 where they *might* copy. With C++11 we can likely remove this in favor of move-only types and containers wrapped around those types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194315 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Move copying of global initializers below the cloning of functions."Adrian Prantl2013-11-09
| | | | | | | | This would cause internal symbols that are only referenced by global initializers to be removed. This reverts commit 194219. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194304 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Run clang-format on file."Adrian Prantl2013-11-09
| | | | | | This reverts commit 194219. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194303 91177308-0d34-0410-b5e6-96231b3b80d8
* Run clang-format on file.Bill Wendling2013-11-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194219 91177308-0d34-0410-b5e6-96231b3b80d8
* Move copying of global initializers below the cloning of functions.Bill Wendling2013-11-07
| | | | | | | | | | The BlockAddress doesn't have access to the correct basic blocks until the functions have been cloned. This causes the BlockAddress to point to the old values. Just wait until the functions have been cloned before copying the initializers. PR13163 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194218 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify ErrorOr.Rafael Espindola2013-11-05
| | | | | | | | | | | | | | | | ErrorOr had quiet a bit of complexity and indirection to be able to hold a user type with the error. That feature is not used anymore. This patch removes it, it will live in svn history if we ever need it again. If we do need it again, IMHO there is one thing that should be done differently: Holding extra info in the error is not a property a function also returning a value or not. The ability to hold extra info should be in the error type and ErrorOr templated over it so that we don't need the funny looking ErrorOr<void>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194030 91177308-0d34-0410-b5e6-96231b3b80d8
* Merge CallGraph and BasicCallGraph.Rafael Espindola2013-10-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193734 91177308-0d34-0410-b5e6-96231b3b80d8
* Add calls to doInitialization() and doFinalization() in verifyFunction()Rafael Espindola2013-10-30
| | | | | | | | | | | | | | | | | | | | | | The function verifyFunction() in lib/IR/Verifier.cpp misses some calls. It creates a temporary FunctionPassManager that will run a single Verifier pass. Unfortunately, FunctionPassManager is no PassManager and does not call doInitialization() and doFinalization() by itself. Verifier does important tasks in doInitialization() such as collecting type information used to check DebugInfo metadata and doFinalization() does some additional checks. Therefore these checks were missed and debug info couldn't be verified at all, it just crashed if the function had some. verifyFunction() is currently not used in llvm unless -debug option is enabled, and in unittests/IR/VerifierTest.cpp VerifierTest had to be changed to create the function in a module from which the type debug info can be collected. Patch by Michael Kruse. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193719 91177308-0d34-0410-b5e6-96231b3b80d8
* Add {start,end}with_lower methods to StringRef.Rui Ueyama2013-10-30
| | | | | | | | | startswith_lower is ocassionally useful and I think worth adding. endwith_lower is added for completeness. Differential Revision: http://llvm-reviews.chandlerc.com/D2041 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193706 91177308-0d34-0410-b5e6-96231b3b80d8
* make ConstantRange::signExtend() optimalNuno Lopes2013-10-30
| | | | | | the case [x, INT_MIN) was not handled optimally git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193694 91177308-0d34-0410-b5e6-96231b3b80d8
* DWARF parser: propery handle DW_FORM_ref_sig8 and fix Windows build.Alexey Samsonov2013-10-29
| | | | | | | Based on D2050 by Timur Iskhodzhanov. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193619 91177308-0d34-0410-b5e6-96231b3b80d8
* DWARF parser: Use ArrayRef to represent form sizes and simplify ↵Alexey Samsonov2013-10-28
| | | | | | DWARFDIE::extractFast() interface. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193560 91177308-0d34-0410-b5e6-96231b3b80d8
* DebugInfo: Introduce the notion of "form classes"Alexey Samsonov2013-10-28
| | | | | | | | | | | | | | | | | | Summary: Use DWARF4 table of form classes to fetch attributes from DIE in a more consistent way. This shouldn't change the functionality and serves as a refactoring for upcoming change: DW_AT_high_pc has different semantics depending on its form class. Reviewers: dblaikie, echristo Reviewed By: echristo CC: echristo, llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1961 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193553 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a few tests for StringRef::{start,end}with.Rui Ueyama2013-10-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193550 91177308-0d34-0410-b5e6-96231b3b80d8
* DIEHash: Summary hashing of member functionsDavid Blaikie2013-10-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193432 91177308-0d34-0410-b5e6-96231b3b80d8
* Try to fix the build on windows.Rafael Espindola2013-10-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193431 91177308-0d34-0410-b5e6-96231b3b80d8
* Change MemoryBuffer::getFile to take a Twine.Rafael Espindola2013-10-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193429 91177308-0d34-0410-b5e6-96231b3b80d8
* DIEHash: Summary hashing of nested typesDavid Blaikie2013-10-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193427 91177308-0d34-0410-b5e6-96231b3b80d8
* DIEHash: Const correct and use references where non-null/non-rebound.David Blaikie2013-10-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193363 91177308-0d34-0410-b5e6-96231b3b80d8
* DIEHash: Do not use shallow type hashing for unnamed typesDavid Blaikie2013-10-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193361 91177308-0d34-0410-b5e6-96231b3b80d8
* Reverting my r193344 checkin due to build breakage.John Thompson2013-10-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193350 91177308-0d34-0410-b5e6-96231b3b80d8
* Added std::string as a built-in type for mapping.John Thompson2013-10-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193344 91177308-0d34-0410-b5e6-96231b3b80d8
* DWARF type hashing: pointers to membersDavid Blaikie2013-10-22
| | | | | | | | | Includes a test case/FIXME demonstrating a bug/limitation in pointer to member hashing. To be honest I'm not sure why we don't just always use summary hashing for referenced types... but perhaps I'm missing something. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193175 91177308-0d34-0410-b5e6-96231b3b80d8
* DWARF Type Hashing: Include reference and rvalue reference type in the ↵David Blaikie2013-10-21
| | | | | | | | declarable summary hashing path More support for 7.25 Part 5. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193129 91177308-0d34-0410-b5e6-96231b3b80d8
* DWARF type hashing: begin implementing Step 5, summary hashing in declarable ↵David Blaikie2013-10-21
| | | | | | | | | contexts There are several other tag types that need similar handling but to ensure test coverage they'll be coming incrementally. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193126 91177308-0d34-0410-b5e6-96231b3b80d8
* Removing unnecessary link component for MCJIT unittestsAndrew Kaylor2013-10-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193125 91177308-0d34-0410-b5e6-96231b3b80d8
* DIEHashTest: Correct the order of operands to the TEST macroDavid Blaikie2013-10-21
| | | | | | And add the 'Test' suffix so the test case name matches the file name. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193119 91177308-0d34-0410-b5e6-96231b3b80d8
* DWARF type hashing: Handle multiple (including recursive) references to the ↵David Blaikie2013-10-21
| | | | | | | | | | same type This uses a map, keeping the type DIE numbering separate from the DIEs themselves - alternatively we could do things the way GCC does if we want to add an integer to the DIE type to record the numbering there. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193105 91177308-0d34-0410-b5e6-96231b3b80d8
* DIEHash: Support for simple (non-recursive, non-reused) type referencesDavid Blaikie2013-10-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192924 91177308-0d34-0410-b5e6-96231b3b80d8
* DIEHash: Include the type's context in the type hash.David Blaikie2013-10-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192856 91177308-0d34-0410-b5e6-96231b3b80d8
* DIEHash: Use DW_FORM_sdata for integers, per spec.David Blaikie2013-10-16
| | | | | | | This allows us to produce the same hash as GCC for at least some simple examples. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192855 91177308-0d34-0410-b5e6-96231b3b80d8
* Invert arguments to ASSERT_EQ to match gtest diagnostic printingDavid Blaikie2013-10-16
| | | | | | | | GTest assumes the left hand side of the assert is the expectation and the right hand side is the test result. It's easier to read gtest failures when these things are ordered correctly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192854 91177308-0d34-0410-b5e6-96231b3b80d8
* DIEHash: Include the trailing zero byte after the children of a DIEDavid Blaikie2013-10-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192836 91177308-0d34-0410-b5e6-96231b3b80d8