summaryrefslogtreecommitdiff
path: root/lib/Transforms/Vectorize
Commit message (Collapse)AuthorAge
* Merge in r168765 (BBVectorize bug fix)Hal Finkel2012-11-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_32@168839 91177308-0d34-0410-b5e6-96231b3b80d8
* Merge r167942, r167966 to fix non-deterministic behavior in BBVectorizeHal Finkel2012-11-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_32@168012 91177308-0d34-0410-b5e6-96231b3b80d8
* Merge BBVectorizer changes r167731, r167743, r167750, r167784, r167811, r167817.Hal Finkel2012-11-14
| | | | | | | | | These changes fix a serious interaction problem with the cost model on x86 that could cause the vectorizer to enter an infinite loop (and sometimes crash in other ways). git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_32@167993 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a comment typo and add comments.Nadav Rotem2012-11-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167684 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for memory runtime check. When we can, we calculate array bounds.Nadav Rotem2012-11-09
| | | | | | | | | If the arrays are found to be disjoint then we run the vectorized version of the loop. If they are not, we run the scalar code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167608 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix sign compare warning. Patch by Mahesha HS.Chandler Carruth2012-11-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167282 91177308-0d34-0410-b5e6-96231b3b80d8
* BBVectorize: Use target costs for incoming and outgoing values instead of ↵Hal Finkel2012-11-01
| | | | | | | | | | | the depth heuristic. When target cost information is available, compute explicit costs of inserting and extracting values from vectors. At this point, all costs are estimated using the target information, and the chain-depth heuristic is not needed. As a result, it is now, by default, disabled when using target costs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167256 91177308-0d34-0410-b5e6-96231b3b80d8
* BBVectorize: Account for internal shuffle costsHal Finkel2012-11-01
| | | | | | | | | | | | | When target costs are available, use them to account for the costs of shuffles on internal edges of the DAG of candidate pairs. Because the shuffle costs here are currently for only the internal edges, the current target cost model is trivial, and the chain depth requirement is still in place, I don't yet have an easy test case. Nevertheless, by looking at the debug output, it does seem to do the right think to the effective "size" of each DAG of candidate pairs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167217 91177308-0d34-0410-b5e6-96231b3b80d8
* LoopVectorize: Preserve NSW, NUW and IsExact flags.Nadav Rotem2012-10-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167174 91177308-0d34-0410-b5e6-96231b3b80d8
* Put the threshold magic number in a variable.Nadav Rotem2012-10-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167134 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove enum values since they are not used anymore.Nadav Rotem2012-10-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167131 91177308-0d34-0410-b5e6-96231b3b80d8
* BBVectorize: Choose pair ordering to minimize shufflesHal Finkel2012-10-31
| | | | | | | | | | | | | | | | | | | | BBVectorize would, except for loads and stores, always fuse instructions so that the first instruction (in the current source order) would always represent the low part of the input vectors and the second instruction would always represent the high part. This lead to too many shuffles being produced because sometimes the opposite order produces fewer of them. With this change, BBVectorize tracks the kind of pair connections that form the DAG of candidate pairs, and uses that information to reorder the pairs to avoid excess shuffles. Using this information, a future commit will be able to add VTTI-based shuffle costs to the pair selection procedure. Importantly, the number of remaining shuffles can now be estimated during pair selection. There are some trivial instruction reorderings in the test cases, and one simple additional test where we certainly want to do a reordering to avoid an unnecessary shuffle. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167122 91177308-0d34-0410-b5e6-96231b3b80d8
* LoopVectorize: Do not vectorize loops with tiny constant trip counts.Nadav Rotem2012-10-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167101 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for loops that don't start with Zero.Nadav Rotem2012-10-31
| | | | | | | | | This is important for loops in the LAPACK test-suite. These loops start at 1 because they are auto-converted from fortran. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167084 91177308-0d34-0410-b5e6-96231b3b80d8
* Add documentation.Nadav Rotem2012-10-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167055 91177308-0d34-0410-b5e6-96231b3b80d8
* BBVectorize: Cache fixed-order pairs instead of recomputing pointer info.Hal Finkel2012-10-30
| | | | | | | | | | | | Instead of recomputing relative pointer information just prior to fusing, cache this information (which also needs to be computed during the candidate-pair selection process). This cuts down on the total number of SE queries made, and also is a necessary intermediate step on the road toward including shuffle costs in the pair selection procedure. No functionality change is intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167049 91177308-0d34-0410-b5e6-96231b3b80d8
* BBVectorize: Fix a small bug introduced in r167042.Hal Finkel2012-10-30
| | | | | | | We need to make sure that we take the correct load/store alignment when the inputs are flipped. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167044 91177308-0d34-0410-b5e6-96231b3b80d8
* BBVectorize: Simplify how input swapping is handled.Hal Finkel2012-10-30
| | | | | | | | | Stop propagating the FlipMemInputs variable into the routines that create the replacement instructions. Instead, just flip the arguments of those routines. This allows for some associated cleanup (not all of which is done here). No functionality change is intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167042 91177308-0d34-0410-b5e6-96231b3b80d8
* BBVectorize: Don't make calls to SE when the result is unused.Hal Finkel2012-10-30
| | | | | | | SE was being called during the instruction-fusion process (when the result is unreliable, and thus ignored). No functionality change is intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167037 91177308-0d34-0410-b5e6-96231b3b80d8
* LoopVectorize: Add support for write-only loops when the write destination ↵Nadav Rotem2012-10-30
| | | | | | | | | | is a single pointer. Speedup SciMark by 1% git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167035 91177308-0d34-0410-b5e6-96231b3b80d8
* LoopVectorize: Fix a bug in the initialization of reduction variables. AND ↵Nadav Rotem2012-10-30
| | | | | | | | | | needs to start at all-one while XOR, and OR need to start at zero. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167032 91177308-0d34-0410-b5e6-96231b3b80d8
* LoopVectorizer: change debug prints: Print the module identifier when ↵Nadav Rotem2012-10-30
| | | | | | deciding to vectorize. When deciding not to vectorize do not print the called function name because it can be null. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166989 91177308-0d34-0410-b5e6-96231b3b80d8
* LoopVectorize: Update and preserve the dominator tree info.Nadav Rotem2012-10-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166970 91177308-0d34-0410-b5e6-96231b3b80d8
* Update BBVectorize to use the new VTTI instr. cost interfaces.Hal Finkel2012-10-27
| | | | | | | | The monolithic interface for instruction costs has been split into several functions. This is the corresponding change. No functionality change is intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166865 91177308-0d34-0410-b5e6-96231b3b80d8
* 1. Fix a bug in getTypeConversion. When a *simple* type is split, we need to ↵Nadav Rotem2012-10-27
| | | | | | | | | | | return the type of the split result. 2. Change the maximum vectorization width from 4 to 8. 3. A test for both. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166864 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor the VectorTargetTransformInfo interface.Nadav Rotem2012-10-26
| | | | | | | | | | | | Add getCostXXX calls for different families of opcodes, such as casts, arithmetic, cmp, etc. Port the LoopVectorizer to the new API. The LoopVectorizer now finds instructions which will remain uniform after vectorization. It uses this information when calculating the cost of these instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166836 91177308-0d34-0410-b5e6-96231b3b80d8
* Use VTTI->getNumberOfParts in BBVectorize.Hal Finkel2012-10-26
| | | | | | This change reflects VTTI refactoring; no functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166752 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable generation of pointer vectors by BBVectorize.Hal Finkel2012-10-26
| | | | | | Once vector-of-pointer support works, then this can be reverted. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166741 91177308-0d34-0410-b5e6-96231b3b80d8
* BBVectorize, when using VTTI, should not form types that will be split.Hal Finkel2012-10-25
| | | | | | | | | This is needed so that perl's SHA can be compiled (otherwise BBVectorize takes far too long to find its fixed point). I'll try to come up with a reduced test case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166738 91177308-0d34-0410-b5e6-96231b3b80d8
* Begin incorporating target information into BBVectorize.Hal Finkel2012-10-25
| | | | | | | | | | | | | | | | | | | | | | | | This is the first of several steps to incorporate information from the new TargetTransformInfo infrastructure into BBVectorize. Two things are done here: 1. Target information is used to determine if it is profitable to fuse two instructions. This means that the cost of the vector operation must not be more expensive than the cost of the two original operations. Pairs that are not profitable are no longer considered (because current cost information is incomplete, for intrinsics for example, equal-cost pairs are still considered). 2. The 'cost savings' computed for the profitability check are also used to rank the DAGs that represent the potential vectorization plans. Specifically, for nodes of non-trivial depth, the cost savings is used as the node weight. The next step will be to incorporate the shuffle costs into the DAG weighting; this will give the edges of the DAG weights as well. Once that is done, when target information is available, we should be able to dispense with the depth heuristic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166716 91177308-0d34-0410-b5e6-96231b3b80d8
* LoopVectorize: Teach the cost model to query scalar costs as scalar types ↵Nadav Rotem2012-10-25
| | | | | | and not vectors of 1. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166715 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for additional reduction variables: AND, OR, XOR.Nadav Rotem2012-10-25
| | | | | | | | Patch by Paul Redmond <paul.redmond@intel.com>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166649 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement a basic cost model for vector and scalar instructions. Nadav Rotem2012-10-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166642 91177308-0d34-0410-b5e6-96231b3b80d8
* whitespaceNadav Rotem2012-10-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166622 91177308-0d34-0410-b5e6-96231b3b80d8
* LoopVectorizer: Add a basic cost model which uses the VTTI interface.Nadav Rotem2012-10-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166620 91177308-0d34-0410-b5e6-96231b3b80d8
* Back out r166591, not sure why this made it through since I cancelled the ↵Micah Villmow2012-10-24
| | | | | | command. Bleh, sorry about this! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166596 91177308-0d34-0410-b5e6-96231b3b80d8
* Delete a directory that wasn't supposed to be checked in yet.Micah Villmow2012-10-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166591 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the AliasAnalysis isIdentifiedObj because it also understands mallocs ↵Nadav Rotem2012-10-23
| | | | | | | | | | and c++ news. PR14158. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166491 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't crash if the load/store pointer is not a GEP.Nadav Rotem2012-10-22
| | | | | | | | Fix by Shivarama Rao <Shivarama.Rao@amd.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166427 91177308-0d34-0410-b5e6-96231b3b80d8
* BBVectorize should ignore unreachable blocks.Hal Finkel2012-10-22
| | | | | | | | | Unreachable blocks can have invalid instructions. For example, jump threading can produce self-referential instructions in unreachable blocks. Also, we should not be spending time optimizing unreachable code. Fixes PR14133. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166423 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename a variable.Nadav Rotem2012-10-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166410 91177308-0d34-0410-b5e6-96231b3b80d8
* Vectorizer: optimize the generation of selects. If the condition is uniform, ↵Nadav Rotem2012-10-22
| | | | | | generate a scalar-cond select (i1 as selector). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166409 91177308-0d34-0410-b5e6-96231b3b80d8
* Update the loop vectorizer docs.Nadav Rotem2012-10-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166408 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid an extra hash lookup when inserting a value into the widen map.Anders Carlsson2012-10-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166395 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify code. No functionality change.Jakub Staszak2012-10-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166393 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify code. No functionality change.Jakub Staszak2012-10-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166392 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bug in the vectorization of wide load/store operations.Nadav Rotem2012-10-21
| | | | | | | | | | We used a SCEV to detect that A[X] is consecutive. We assumed that X was the induction variable. But X can be any expression that uses the induction for example: X = i + 2; git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166388 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for reduction variables that do not start at zero.Nadav Rotem2012-10-21
| | | | | | | | | | | | | | This is important for nested-loop reductions such as : In the innermost loop, the induction variable does not start with zero: for (i = 0 .. n) for (j = 0 .. m) sum += ... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166387 91177308-0d34-0410-b5e6-96231b3b80d8
* Document change. Describe the pass and some papers that inspired the design ↵Nadav Rotem2012-10-21
| | | | | | of the pass. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166386 91177308-0d34-0410-b5e6-96231b3b80d8
* Vectorizer: fix a bug in the classification of induction/reduction phis.Nadav Rotem2012-10-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166384 91177308-0d34-0410-b5e6-96231b3b80d8