summaryrefslogtreecommitdiff
path: root/unittests
Commit message (Collapse)AuthorAge
...
* SmallVector: Move, don't copy, elements to make space for an insertion.David Blaikie2014-06-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210432 91177308-0d34-0410-b5e6-96231b3b80d8
* SmallVectorTest: Remove some more robust checks added in r210429 since they ↵David Blaikie2014-06-08
| | | | | | | | | | | caught some bugs I haven't fixed yet. Specifically this caused inserting an element from a SmallVector into itself when such an insertion would cause a reallocation. We have code to handle this for non-reallocating cases, but it's not robust against reallocation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210430 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some more moving-from-moved-from objects issues in SmallVectorDavid Blaikie2014-06-08
| | | | | | | | (& because it makes it easier to test, this also improves correctness/performance slightly by moving the last element in an insert operation, rather than copying it) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210429 91177308-0d34-0410-b5e6-96231b3b80d8
* APFloat: x - NaN needs to flip the signbit of NaN when x is a number.Stephen Canon2014-06-08
| | | | | | Because we don't have a separate negate( ) function, 0 - NaN does double-duty as the IEEE-754 negate( ) operation, which (unlike most FP ops) *does* attach semantic meaning to the signbit of NaN. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210428 91177308-0d34-0410-b5e6-96231b3b80d8
* Ensure SmallVector::insert doesn't overwrite the last element in the range ↵David Blaikie2014-06-08
| | | | | | | | | | | | | | with the already-moved-from value This would cause the last element in a range to be in a moved-from state after an insert at a non-end position, losing that value entirely in the process. Side note: move_backward is subtle. It copies [A, B) to C-1 and down. (the fact that it decrements both the second and third iterators before the first movement is the subtle part... kind of surprising, anyway) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210426 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix build when no native target is enabledAlp Toker2014-06-08
| | | | | | | The JITTests and MCJITTests unit test targets require a native arch with JIT support, otherwise fail to link. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210411 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow aliases to be unnamed_addr.Rafael Espindola2014-06-06
| | | | | | | | | | | | | | | | | | Alias with unnamed_addr were in a strange state. It is stored in GlobalValue, the language reference talks about "unnamed_addr aliases" but the verifier was rejecting them. It seems natural to allow unnamed_addr in aliases: * It is a property of how it is accessed, not of the data itself. * It is perfectly possible to write code that depends on the address of an alias. This patch then makes unname_addr legal for aliases. One side effect is that the syntax changes for a corner case: In globals, unnamed_addr is now printed before the address space. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210302 91177308-0d34-0410-b5e6-96231b3b80d8
* Make this operator bool() explicit to match the standard library.Rafael Espindola2014-06-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210072 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow alias to point to an arbitrary ConstantExpr.Rafael Espindola2014-06-03
| | | | | | | | | | | | | | | | | | | | | This patch changes GlobalAlias to point to an arbitrary ConstantExpr and it is up to MC (or the system assembler) to decide if that expression is valid or not. This reduces our ability to diagnose invalid uses and how early we can spot them, but it also lets us do things like @test5 = alias inttoptr(i32 sub (i32 ptrtoint (i32* @test2 to i32), i32 ptrtoint (i32* @bar to i32)) to i32*) An important implication of this patch is that the notion of aliased global doesn't exist any more. The alias has to encode the information needed to access it in its metadata (linkage, visibility, type, etc). Another consequence to notice is that getSection has to return a "const char *". It could return a NullTerminatedStringRef if there was such a thing, but when that was proposed the decision was to just uses "const char*" for that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210062 91177308-0d34-0410-b5e6-96231b3b80d8
* Use error_code() instead of error_code::succes()Rafael Espindola2014-05-31
| | | | | | | There is no std::error_code::success, so this removes much of the noise in transitioning to std::error_code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209952 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the behavior of ExecuteAndWait with a non-zero timeout.Peter Collingbourne2014-05-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209951 91177308-0d34-0410-b5e6-96231b3b80d8
* Use std::unique_ptr instead of OwningPtr in the MemoryBuffer unittests.Craig Topper2014-05-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209102 91177308-0d34-0410-b5e6-96231b3b80d8
* Use create methods since msvc doesn't handle delegating constructors.Rafael Espindola2014-05-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209076 91177308-0d34-0410-b5e6-96231b3b80d8
* Reduce abuse of default values in the GlobalAlias constructor.Rafael Espindola2014-05-17
| | | | | | This is in preparation for adding an optional offset. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209073 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix most of PR10367.Rafael Espindola2014-05-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the design of GlobalAlias so that it doesn't take a ConstantExpr anymore. It now points directly to a GlobalObject, but its type is independent of the aliasee type. To avoid changing all alias related tests in this patches, I kept the common syntax @foo = alias i32* @bar to mean the same as now. The cases that used to use cast now use the more general syntax @foo = alias i16, i32* @bar. Note that GlobalAlias now behaves a bit more like GlobalVariable. We know that its type is always a pointer, so we omit the '*'. For the bitcode, a nice surprise is that we were writing both identical types already, so the format change is minimal. Auto upgrade is handled by looking through the casts and no new fields are needed for now. New bitcode will simply have different types for Alias and Aliasee. One last interesting point in the patch is that replaceAllUsesWith becomes smart enough to avoid putting a ConstantExpr in the aliasee. This seems better than checking and updating every caller. A followup patch will delete getAliasedGlobal now that it is redundant. Another patch will add support for an explicit offset. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209007 91177308-0d34-0410-b5e6-96231b3b80d8
* Change the GlobalAlias constructor to look a bit more like GlobalVariable.Rafael Espindola2014-05-16
| | | | | | | This is part of the fix for pr10367. A GlobalAlias always has a pointer type, so just have the constructor build the type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208983 91177308-0d34-0410-b5e6-96231b3b80d8
* Add C API for thread yielding callback.Juergen Ributzka2014-05-16
| | | | | | | | | | | | | | | | | | | | | Sometimes a LLVM compilation may take more time then a client would like to wait for. The problem is that it is not possible to safely suspend the LLVM thread from the outside. When the timing is bad it might be possible that the LLVM thread holds a global mutex and this would block any progress in any other thread. This commit adds a new yield callback function that can be registered with a context. LLVM will try to yield by calling this callback function, but there is no guaranteed frequency. LLVM will only do so if it can guarantee that suspending the thread won't block any forward progress in other LLVM contexts in the same process. Once the client receives the call back it can suspend the thread safely and resume it at another time. Related to <rdar://problem/16728690> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208945 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[PM] Add pass run listeners to the pass manager."Juergen Ributzka2014-05-15
| | | | | | | Revert the current implementation and C API. New implementation and C APIs are in the works. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208904 91177308-0d34-0410-b5e6-96231b3b80d8
* Assert that we don't RAUW a Constant with a ConstantExpr that contains it.Rafael Espindola2014-05-13
| | | | | | | | We already had an assert for foo->RAUW(foo), but not for something like foo->RAUW(GEP(foo)) and would go in an infinite loop trying to apply the replacement. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208663 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove use of = default/= delete as they're unsupported on MSVC2012David Blaikie2014-05-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208388 91177308-0d34-0410-b5e6-96231b3b80d8
* Missed formattingDavid Blaikie2014-05-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208362 91177308-0d34-0410-b5e6-96231b3b80d8
* StringMap: Move assignment and move construction.David Blaikie2014-05-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208361 91177308-0d34-0410-b5e6-96231b3b80d8
* StringMap support for move-only values.David Blaikie2014-05-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208359 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace a virtual with an override.Rafael Espindola2014-05-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208242 91177308-0d34-0410-b5e6-96231b3b80d8
* Copy the full TailCallKind in CallInst::clone_implReid Kleckner2014-05-06
| | | | | | | Split from the musttail inliner change. This will be covered by an opt test when the inliner change lands. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208126 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable -Wcomment when building with GCC.Evgeniy Stepanov2014-05-06
| | | | | | | | | | GCC version of -Wcomment is not compatible with ascii art graph diagrams. Reverts r207629. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208073 91177308-0d34-0410-b5e6-96231b3b80d8
* [LCG] Add the last (and most complex) of the edge insertion mutationChandler Carruth2014-05-04
| | | | | | | | | | | | | operations on the call graph. This one forms a cycle, and while not as complex as removing an internal edge from an SCC, it involves a reasonable amount of work to find all of the nodes newly connected in a cycle. Also somewhat alarming is the worst case complexity here: it might have to walk roughly the entire SCC inverse DAG to insert a single edge. This is carefully documented in the API (I hope). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207935 91177308-0d34-0410-b5e6-96231b3b80d8
* [LCG] Reorder the tests to be a bit more logical: inter-SCC mutationChandler Carruth2014-05-04
| | | | | | | | before intra-SCC mutation, insertion before removal. No functionality changed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207934 91177308-0d34-0410-b5e6-96231b3b80d8
* [TBAA] Fix handling of mixed TBAA (path-aware and non-path-aware TBAA).Juergen Ributzka2014-05-03
| | | | | | | | | | | | | | This fix simply ensures that both metadata nodes are path-aware before performing path-aware alias analysis. This issue isn't normally triggered in LLVM, because we perform an autoupgrade of the TBAA metadata to the new format when reading in LL or BC files. This issue only appears when a client creates the IR manually and mixes old and new TBAA metadata format. This fixes <rdar://problem/16760860>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207923 91177308-0d34-0410-b5e6-96231b3b80d8
* [LCG] Add the other simple edge insertion API to the call graph. ThisChandler Carruth2014-05-01
| | | | | | | | | just connects an SCC to one of its descendants directly. Not much of an impact. The last one is the hard one -- connecting an SCC to one of its ancestors, and thereby forming a cycle such that we have to merge all the SCCs participating in the cycle. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207751 91177308-0d34-0410-b5e6-96231b3b80d8
* [LCG] Add some basic methods for querying the parent/child relationshipsChandler Carruth2014-05-01
| | | | | | | | of SCCs in the SCC DAG. Exercise them in the big graph test case. These will be especially useful for establishing invariants in insertion logic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207749 91177308-0d34-0410-b5e6-96231b3b80d8
* ELFObjectWriter: deduplicate suffices in strtabHans Wennborg2014-04-30
| | | | | | | | | | | | | | | We already do this for shstrtab, so might as well do it for strtab. This extracts the string table building code into a separate class. The idea is to use it for other object formats too. I mostly wanted to do this for the general principle, but it does save a little bit on object file size. I tried this on a clang bootstrap and saved 0.54% on the sum of object file sizes (1.14 MB out of 212 MB for a release build). Differential Revision: http://reviews.llvm.org/D3533 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207670 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a use of uninitialized memory in SmallVector's move-assignment operator.Douglas Gregor2014-04-30
| | | | | | | | | When we were moving from a larger vector to a smaller one but didn't need to re-allocate, we would move-assign over uninitialized memory in the target, then move-construct that same data again. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207663 91177308-0d34-0410-b5e6-96231b3b80d8
* [LCG] Add the really, *really* boring edge insertion case: adding anChandler Carruth2014-04-30
| | | | | | | | | | edge entirely within an existing SCC. Shockingly, making the connected component more connected is ... a total snooze fest. =] Anyways, its wired up, and I even added a test case to make sure it pretty much sorta works. =D git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207631 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix multiline comment warning.Evgeniy Stepanov2014-04-30
| | | | | | | | | ../unittests/Analysis/LazyCallGraphTest.cpp:45:1: warning: multi-line comment [-Wcomment] // / \ ^ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207629 91177308-0d34-0410-b5e6-96231b3b80d8
* [LCG] Actually test the *basic* edge removal bits (IE, the non-SCCChandler Carruth2014-04-30
| | | | | | | | | | | | | | | | | | | | | | | | | | bits), and discover that it's totally broken. Yay tests. Boo bug. Fix the basic edge removal so that it works by nulling out the removed edges rather than actually removing them. This leaves the indices valid in the map from callee to index, and preserves some of the locality for iterating over edges. The iterator is made bidirectional to reflect that it now has to skip over null entries, and the skipping logic is layered onto it. As future work, I would like to track essentially the "load factor" of the edge list, and when it falls below a threshold do a compaction. An alternative I considered (and continue to consider) is storing the callees in a doubly linked list where each element of the list is in a set (which is essentially the classical linked-hash-table datastructure). The problem with that approach is that either you need to heap allocate the linked list nodes and use pointers to them, or use a bucket hash table (with even *more* linked list pointer overhead!), etc. It's pretty easy to get 5x overhead for values that are just pointers. So far, I think punching holes in the vector, and periodic compaction is likely to be much more efficient overall in the space/time tradeoff. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207619 91177308-0d34-0410-b5e6-96231b3b80d8
* 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