aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Introduce a SmallDenseMap container that re-uses the existing DenseMapChandler Carruth2012-06-172-41/+332
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implementation. This type includes an inline bucket array which is used initially. Once it is exceeded, an array of 64 buckets is allocated on the heap. The bucket count grows from there as needed. Some highlights of this implementation: - The inline buffer is very carefully aligned, and so supports types with alignment constraints. - It works hard to avoid aliasing issues. - Supports types with non-trivial constructors, destructors, copy constructions, etc. It works reasonably hard to minimize copies and unnecessary initialization. The most common initialization is to set keys to the empty key, and so that should be fast if at all possible. This class has a performance / space trade-off. It tries to optimize for relatively small maps, and so packs the inline bucket array densely into the object. It will be marginally slower than a normal DenseMap in a few use patterns, so it isn't appropriate everywhere. The unit tests for DenseMap have been generalized a bit to support running over different map implementations in addition to different key/value types. They've then been automatically extended to cover the new container through the magic of GoogleTest's typed tests. All of this is still a bit rough though. I'm going to be cleaning up some aspects of the implementation, documenting things better, and adding tests which include non-trivial types. As soon as I'm comfortable with the correctness, I plan to switch existing users of SmallMap over to this class as it is already more correct w.r.t. construction and destruction of objects iin the map. Thanks to Benjamin Kramer for all the reviews of this and the lead-up patches. That said, more review on this would really be appreciated. As I've noted a few times, I'm quite surprised how hard it is to get the semantics for a hashtable-based map container with a small buffer optimization correct. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158638 91177308-0d34-0410-b5e6-96231b3b80d8
* Add some somewhat exhaustive tests of sizeof properties of this horribleChandler Carruth2012-06-171-0/+60
| | | | | | construct just for my sanity. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158637 91177308-0d34-0410-b5e6-96231b3b80d8
* Now that SROA can form alloca's for dynamic vector accesses, further improve ↵Pete Cooper2012-06-172-61/+161
| | | | | | it to be able to replace operations on these vector alloca's with insert/extract element insts git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158623 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable the right instance of TheJIT, this one is only used in asserts.Benjamin Kramer2012-06-161-8/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158610 91177308-0d34-0410-b5e6-96231b3b80d8
* Guard private fields that are unused in Release builds with #ifndef NDEBUG.Benjamin Kramer2012-06-164-3/+21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158608 91177308-0d34-0410-b5e6-96231b3b80d8
* Cleanup trip-count finding for PPC CTR loops (and some bug fixes).Hal Finkel2012-06-163-86/+417
| | | | | | | | | | | | | | This cleans up the method used to find trip counts in order to form CTR loops on PPC. This refactoring allows the pass to find loops which have a constant trip count but also happen to end with a comparison to zero. This also adds explicit FIXMEs to mark two different classes of loops that are currently ignored. In addition, we now search through all potential induction operations instead of just the first. Also, we check the predicate code on the conditional branch and abort the transformation if the code is not EQ or NE, and we then make sure that the branch to be transformed matches the condition register defined by the comparison (multiple possible comparisons will be considered). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158607 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach BBVectorize to combine, when possible, or discard metadata when fusing ↵Hal Finkel2012-06-162-0/+79
| | | | | | | | | | | | instructions. The present implementation handles only TBAA and FP metadata, discarding everything else. For debug metadata, the current behavior is maintained (the debug metadata associated with one of the instructions will be kept, discarding that attached to the other). This should address PR 13040. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158606 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the Metadata merging methods from GVN and make them public in MDNode.Hal Finkel2012-06-163-153/+158
| | | | | | | There are other passes, BBVectorize specifically, that also need some of this functionality. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158605 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement irpc. Extracted from a patch by the PaX team. I just added the test.Rafael Espindola2012-06-162-0/+66
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158604 91177308-0d34-0410-b5e6-96231b3b80d8
* *no need to pollute Intel syntax with bonus mnemonics; operand size is ↵Kay Tiong Khoo2012-06-161-6/+6
| | | | | | explicitly specified git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158603 91177308-0d34-0410-b5e6-96231b3b80d8
* Mips/AsmParser/CMakeLists.txt: Fix dependency.NAKAMURA Takumi2012-06-161-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158602 91177308-0d34-0410-b5e6-96231b3b80d8
* Update CMake build.Benjamin Kramer2012-06-161-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158601 91177308-0d34-0410-b5e6-96231b3b80d8
* Merge the SmallBitVector and BitVector unit tests with gtest's typed test ↵Benjamin Kramer2012-06-163-212/+91
| | | | | | magic and bring SmallBitVector up to date. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158600 91177308-0d34-0410-b5e6-96231b3b80d8
* Relax one assertion -- long double has strange alignments on lots ofChandler Carruth2012-06-161-1/+6
| | | | | | | | | platforms. Also, remove one assertion on MSVC because it produces a completely preposterous result, claiming something needs 12-byte alignment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158599 91177308-0d34-0410-b5e6-96231b3b80d8
* Try to reduce the size of the array used for compile-time testing byChandler Carruth2012-06-161-44/+48
| | | | | | making the bounds all '1', and chunking it a bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158598 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support to the alignment support header for conjuring a characterChandler Carruth2012-06-163-0/+339
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | array of a suitable size and alignment for any of a number of different types to be stored into the character array. The mechanisms for producing an explicitly aligned type are fairly complex because this operation is poorly supported on all compilers. We've spent a fairly significant amount of time experimenting with different implementations inside of Google, and the one using explicitly expanded templates has been the most robust. Credit goes to Nick Lewycky for writing the first 20 versions or so of this logic we had inside of Google. I based this on the only one to actually survive. In case anyone is worried, yes we are both explicitly re-contributing and re-licensing it for LLVM. =] Once the issues with actually specifying the alignment are finished, it turns out that most compilers don't in turn align anything the way they are instructed. Testing of this logic against both Clang and GCC indicate that the alignment constraints are largely ignored by both compilers! I've come up with and used a work-around by wrapping each alignment-hinted type directly in a struct, and using that struct to align the character array through a union. This elaborate hackery is terrifying, but I've included testing that caught a terrifying number of bugs in every other technique I've tried. All of this in order to implement a poor C++98 programmers emulation of C++11 unrestricted unions in classes such as SmallDenseMap. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158597 91177308-0d34-0410-b5e6-96231b3b80d8
* It's not deterministic to iterate over SmallPtrSet. Replace it with ↵Evan Cheng2012-06-161-14/+14
| | | | | | SmallSetVector. Patch by Daniel Reynaud. rdar://11671029 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158594 91177308-0d34-0410-b5e6-96231b3b80d8
* Work around a bug with MSVC 10 where it fails to recognize a valid useChandler Carruth2012-06-161-0/+9
| | | | | | | | | of typename. GCC and Clang were fine with this, but MSVC won't accept it. Fortunately, it also doesn't need it. Yuck. Thanks to Nakamura for pointing this out in IRC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158593 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix crash from r158529 on Bullet.Pete Cooper2012-06-162-1/+65
| | | | | | | | Dynamic GEPs created by SROA needed to insert extra "i32 0" operands to index through structs and arrays to get to the vector being indexed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158590 91177308-0d34-0410-b5e6-96231b3b80d8
* Type parameterize the DenseMap unit tests.Chandler Carruth2012-06-161-87/+102
| | | | | | | | | | | | These were already trying to be type parameterized over different key/value pairs. I've realized this goal using GoogleTest's typed test functionality. This allows us to easily replicate the tests across different key/value combinations and soon different mapping templates. I've fixed a few bugs in the tests and extended them a bit in the process as many tests were only applying to the int->int mapping. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158589 91177308-0d34-0410-b5e6-96231b3b80d8
* Lift the NumElements and NumTombstones members into the super classChandler Carruth2012-06-161-37/+78
| | | | | | | | | | | | | | | rather than the base class. Add a pile of boilerplate to indirect around this. This is pretty ugly, but it allows the super class to change the representation of these values, which will be key for doing a SmallDenseMap. Suggestions on better method structuring / naming are welcome, but keep in mind that SmallDenseMap won't have an 'unsigned' member to expose a reference to... =/ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158586 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor DenseMap into a base class that implements the hashtable logic,Chandler Carruth2012-06-161-195/+249
| | | | | | | | | | and a derived class that provides the allocation and growth strategy. This is the first (and biggest) step toward building a SmallDenseMap that actually behaves exactly the same as DenseMap, and supports all the same types and interface points with the same semantics. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158585 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't call 'FilesToRemove[0]' when the vector is empty, even to computeChandler Carruth2012-06-161-1/+1
| | | | | | | the address of it. Found by a checking STL implementation used on a dragonegg builder. Sorry about this one. =/ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158582 91177308-0d34-0410-b5e6-96231b3b80d8
* Harden the Unix signals code to be more async signal safe.Chandler Carruth2012-06-161-9/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is likely only the tip of the ice berg, but this particular bug caused any double-free on a glibc system to turn into a deadlock! It is not generally safe to either allocate or release heap memory from within the signal handler. The 'pop_back()' in RemoveFilesToRemove was deleting memory and causing the deadlock. What's worse, eraseFromDisk in PathV1 has lots of allocation and deallocation paths. We even passed 'true' in a place that would have caused the *signal handler* to try to run the 'system' system call and shell out to 'rm -rf'. That was never going to work... This patch switches the file removal to use a vector of strings so that the exact text needed for the 'unlink' system call can be stored there. It switches the loop to be a boring indexed loop, and directly calls unlink without looking at the error. It also works quite hard to ensure that calling 'c_str()' is safe, by ensuring that the non-signal-handling code path that manipulates the vector always leaves it in a state where every element has already had 'c_str()' called at least once. I dunno exactly how overkill this is, but it fixes the deadlock-on-double free issue, and seems likely to prevent any other issues from sneaking up. Sorry for not having a test case, but I *really* don't know how to test signal handling code easily.... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158580 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove final verification in RABasic.Jakob Stoklund Olesen2012-06-151-20/+0
| | | | | | | We now have a proper machine code verifier pass between register allocation and rewriting. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158577 91177308-0d34-0410-b5e6-96231b3b80d8
* Print out register number in InlineSpiller.Jakob Stoklund Olesen2012-06-151-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158575 91177308-0d34-0410-b5e6-96231b3b80d8
* Unit test for LSR kind=Special fix: r158536.Andrew Trick2012-06-151-0/+102
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158570 91177308-0d34-0410-b5e6-96231b3b80d8
* Accept null PhysReg arguments to checkRegMaskInterference.Jakob Stoklund Olesen2012-06-152-2/+3
| | | | | | | Calling checkRegMaskInterference(VirtReg) checks if VirtReg crosses any regmask operands, regardless of the registers they clobber. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158563 91177308-0d34-0410-b5e6-96231b3b80d8
* [docs] Make it pretty.Michael J. Spencer2012-06-151-5/+34
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158561 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the encoding of the armv7m (MClass) for MSR registers other than aspr,Kevin Enderby2012-06-153-31/+41
| | | | | | | iaspr, espr and xpsr which also needed to have 0b10 in their mask encoding bits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158560 91177308-0d34-0410-b5e6-96231b3b80d8
* ARM: optimization for sub+abs.Manman Ren2012-06-153-14/+27
| | | | | | | | | | | | | | | | This patch will optimize abs(x-y) FROM sub, movs, rsbmi TO subs, rsbmi For abs, we will use cmp instead of movs. This is necessary because we already have an existing peephole pass which optimizes away cmp following sub. rdar: 11633193 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158551 91177308-0d34-0410-b5e6-96231b3b80d8
* *fixed to separate mnemonic from operands with tabKay Tiong Khoo2012-06-151-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158543 91177308-0d34-0410-b5e6-96231b3b80d8
* LSR: fix expansion of scaled reg in non-address type formulae.Andrew Trick2012-06-151-13/+17
| | | | | | | | | For non-address users, Base and Scaled registers are not specially associated to fit an address mode, so SCEVExpander should apply normal expansion rules. Otherwise we may sink computation into inner loops that have already been optimized. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158537 91177308-0d34-0410-b5e6-96231b3b80d8
* LSR fix: "Special" users are just like "Basic" users but allow -1 scale.Andrew Trick2012-06-151-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158536 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove assignments which aren't used afterwards.Bill Wendling2012-06-151-3/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158535 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove assignments which aren't used afterwards.Bill Wendling2012-06-151-2/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158534 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow SROA to split up an array of vectors into multiple vectors, even when ↵Pete Cooper2012-06-152-3/+112
| | | | | | the vectors are dynamically indexed git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158529 91177308-0d34-0410-b5e6-96231b3b80d8
* Some optimizations done by globalopt are safe only for internal linkage, notRafael Espindola2012-06-152-0/+15
| | | | | | | | linkonce linkage. For example, it is not valid to add unnamed_addr. This also fixes a crash in g++.dg/opt/static5.C. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158528 91177308-0d34-0410-b5e6-96231b3b80d8
* Preserve <undef> flags in ARMExpandPseudo.Jakob Stoklund Olesen2012-06-152-5/+14
| | | | | | This probably mostly shows up in bugpoint-generated code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158527 91177308-0d34-0410-b5e6-96231b3b80d8
* Use regunit liveness in RegisterCoalescer when it is available.Jakob Stoklund Olesen2012-06-151-13/+21
| | | | | | | We only do very limited physreg coalescing now, but we still merge virtual registers into reserved registers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158526 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor macro argument parsing into helper methods and add support for .irp.Rafael Espindola2012-06-153-30/+133
| | | | | | | Patch extracted from a larger one by the PaX team. I added the testcases and tightened error handling a bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158523 91177308-0d34-0410-b5e6-96231b3b80d8
* Free the allocated filename. Found by clang static analyzer.Bill Wendling2012-06-151-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158513 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix issues (infinite loop and/or crash) with self-referential instructions, forDuncan Sands2012-06-152-6/+39
| | | | | | | | example degenerate phi nodes and binops that use themselves in unreachable code. Thanks to Charles Davis for the testcase that uncovered this can of worms. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158508 91177308-0d34-0410-b5e6-96231b3b80d8
* Move AVX version of convert instructions that write to GPRs to the Op1 table.Craig Topper2012-06-151-9/+13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158497 91177308-0d34-0410-b5e6-96231b3b80d8
* Had a closing brace inside an #ifdef -- oops!Marshall Clow2012-06-151-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158485 91177308-0d34-0410-b5e6-96231b3b80d8
* Adding acessors to COFFObjectFile so that clients can get at the ↵Marshall Clow2012-06-152-0/+36
| | | | | | (non-generic) bits git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158484 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit r158407: Allow SROA to look at a vector type and see if the offset ↵Pete Cooper2012-06-142-9/+33
| | | | | | is out of range to be replaced with a scalar access. Now with additional fix and test for indexing into a vector inside a struct git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158479 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement the isSafeToDiscardIfUnused predicate and use it in globalopt andRafael Espindola2012-06-144-8/+34
| | | | | | | globaldce. Globaldce was already removing linkonce globals, but globalopt was not. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158476 91177308-0d34-0410-b5e6-96231b3b80d8
* Move X86::VCVTTSD2SIrr from the 2 operand to 1 operand MemRegOp table.Pete Cooper2012-06-141-1/+1
| | | | | | | Can someone with more knowledge of this please look at other entries to see if others need moved. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158474 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix coding style violations. Remove white spaces and tabs.Akira Hatanaka2012-06-1418-91/+91
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158471 91177308-0d34-0410-b5e6-96231b3b80d8