summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Random cleanup: No need to use a std::vector here, since ↵Bill Wendling2013-08-301-5/+4
| | | | | | createInternalizePass uses an ArrayRef. llvm-svn: 189632
* Revert: r189565 - Add getUnrollingPreferences to TTIHal Finkel2013-08-291-17/+5
| | | | | | | | | | | | | | | Revert unintentional commit (of an unreviewed change). Original commit message: Add getUnrollingPreferences to TTI Allow targets to customize the default behavior of the generic loop unrolling transformation. This will be used by the PowerPC backend when targeting the A2 core (which is in-order with a deep pipeline), and using more aggressive defaults is important. llvm-svn: 189566
* Add getUnrollingPreferences to TTIHal Finkel2013-08-291-5/+17
| | | | | | | | | Allow targets to customize the default behavior of the generic loop unrolling transformation. This will be used by the PowerPC backend when targeting the A2 core (which is in-order with a deep pipeline), and using more aggressive defaults is important. llvm-svn: 189565
* Vectorizer/PassManager: I am working on moving the vectorizer out of the ↵Nadav Rotem2013-08-281-46/+18
| | | | | | | | | | | SCC passes. This patch moves the SLP-vectorizer and BB-vectorizer back into SCC passes for two reasons: 1. They are a kind of cannonicalization. 2. The performance measurements show that it is better to keep them in. There should be no functional change if you are not enabling the LateVectorization mode. llvm-svn: 189539
* Fix typo.Matt Arsenault2013-08-281-2/+2
| | | | llvm-svn: 189524
* Disable unrolling in the loop vectorizer when disabled in the pass managerHal Finkel2013-08-282-8/+13
| | | | | | | | | | | | | | | | | When unrolling is disabled in the pass manager, the loop vectorizer should also not unroll loops. This will allow the -fno-unroll-loops option in Clang to behave as expected (even for vectorizable loops). The loop vectorizer's -force-vector-unroll option will (continue to) override the pass-manager setting (including -force-vector-unroll=0 to force use of the internal auto-selection logic). In order to test this, I added a flag to opt (-disable-loop-unrolling) to force disable unrolling through opt (the analog of -fno-unroll-loops in Clang). Also, this fixes a small bug in opt where the loop vectorizer was enabled only after the pass manager populated the queue of passes (the global_alias.ll test needed a slight update to the RUN line as a result of this fix). llvm-svn: 189499
* 80 colsAlexey Samsonov2013-08-281-3/+4
| | | | llvm-svn: 189473
* DataFlowSanitizer: Implement trampolines for function pointers passed to ↵Peter Collingbourne2013-08-271-3/+77
| | | | | | | | custom functions. Differential Revision: http://llvm-reviews.chandlerc.com/D1503 llvm-svn: 189408
* Refactor 'vectorizeLoop' no functionality change.Nadav Rotem2013-08-271-187/+53
| | | | | | This patch merges LoopVectorize of InnerLoopVectorizer and InnerLoopUnroller by adding checks for VF=1. This helps in erasing the Unroller code that is almost identical to the InnerLoopVectorizer code. llvm-svn: 189391
* Fixed typo.Michael Gottesman2013-08-271-1/+1
| | | | | | Noticed by Stephen Checkoway <s@pahtak.org>. llvm-svn: 189312
* Fix inserting instructions before last in bundle.Matt Arsenault2013-08-261-16/+20
| | | | | | | | | | | The builder inserts from before the insert point, not after, so this would insert before the last instruction in the bundle instead of after it. I'm not sure if this can actually be a problem with any of the current insertions. llvm-svn: 189285
* LoopVectorize: Implement partial loop unrolling when vectorization is not ↵Nadav Rotem2013-08-261-167/+495
| | | | | | | | | | | | | | | | profitable. This patch enables unrolling of loops when vectorization is legal but not profitable. We add a new class InnerLoopUnroller, that extends InnerLoopVectorizer and replaces some of the vector-specific logic with scalars. This patch does not introduce any runtime regressions and improves the following workloads: SingleSource/Benchmarks/Shootout/matrix -22.64% SingleSource/Benchmarks/Shootout-C++/matrix -13.06% External/SPEC/CINT2006/464_h264ref/464_h264ref -3.99% SingleSource/Benchmarks/Adobe-C++/simple_types_constant_folding -1.95% llvm-svn: 189281
* test commit. Remove blank lineYi Jiang2013-08-261-1/+0
| | | | llvm-svn: 189265
* Fix unused variable in release buildMatt Arsenault2013-08-261-3/+2
| | | | llvm-svn: 189264
* Constify functionsMatt Arsenault2013-08-261-6/+8
| | | | llvm-svn: 189234
* Vectorize starting from insertelements building a vectorMatt Arsenault2013-08-261-3/+57
| | | | llvm-svn: 189233
* Check if in set on insertion instead of separatelyMatt Arsenault2013-08-241-7/+3
| | | | llvm-svn: 189179
* Add a function object to compare the first or second component of a std::pair.Benjamin Kramer2013-08-241-26/+5
| | | | | | Replace instances of this scattered around the code base. llvm-svn: 189169
* DataFlowSanitizer: correctly combine labels in the case where they are equal.Peter Collingbourne2013-08-231-1/+1
| | | | llvm-svn: 189133
* [msan] Fix handling of va_arg overflow area on x86_64.Evgeniy Stepanov2013-08-231-2/+1
| | | | | | | | The code was erroneously reading overflow area shadow from the TLS slot, bypassing the local copy. Reading shadow directly from TLS is wrong, because it can be overwritten by a nested vararg call, if that happens before va_start. llvm-svn: 189104
* Turn MipsOptimizeMathLibCalls into a target-independent scalar transformRichard Sandiford2013-08-233-0/+162
| | | | | | | | | | ...so that it can be used for z too. Most of the code is the same. The only real change is to use TargetTransformInfo to test when a sqrt instruction is available. The pass is opt-in because at the moment it only handles sqrt. llvm-svn: 189097
* 80 colsAlexey Samsonov2013-08-231-3/+3
| | | | llvm-svn: 189091
* Update StripDeadDebugInfo to use DebugInfoFinder so that it is no longer ↵Michael Gottesman2013-08-231-62/+93
| | | | | | | | | | | | | | | | | | | | | stale to the point of not working and more resilient to debug info changes. The current version of StripDeadDebugInfo became stale and no longer actually worked since it was expecting an older version of debug info. This patch updates it to use DebugInfoFinder and the modern DebugInfo classes as much as possible to make it more redundent to such changes. Additionally, the only place where that was avoided (the code where we replace the old sets with the new), I call verify on the DIContextUnit implying that if the format changes and my live set changes no longer make sense an assert will be hit. In order to ensure that that occurs I have included a test case. The actual stripping of the dead debug info follows the same strategy as was used before in this class: find the live set and replace the old set in the given compile unit (which may contain dead global variables/functions) with the new live one. llvm-svn: 189078
* DataFlowSanitizer: Replace non-instrumented aliases of instrumented ↵Peter Collingbourne2013-08-221-1/+12
| | | | | | | | functions, and vice versa, with wrappers. Differential Revision: http://llvm-reviews.chandlerc.com/D1442 llvm-svn: 189054
* DataFlowSanitizer: Factor the wrapper builder out to buildWrapperFunction.Peter Collingbourne2013-08-221-20/+33
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D1441 llvm-svn: 189053
* DataFlowSanitizer: Prefix the name of each instrumented function with "dfs$".Peter Collingbourne2013-08-221-7/+51
| | | | | | | | | | | | | | | | DFSan changes the ABI of each function in the module. This makes it possible for a function with the native ABI to be called with the instrumented ABI, or vice versa, thus possibly invoking undefined behavior. A simple way of statically detecting instances of this problem is to prepend the prefix "dfs$" to the name of each instrumented-ABI function. This will not catch every such problem; in particular function pointers passed across the instrumented-native barrier cannot be used on the other side. These problems could potentially be caught dynamically. Differential Revision: http://llvm-reviews.chandlerc.com/D1373 llvm-svn: 189052
* Teach the SLP vectorizer the correct way to check for consecutive accessChandler Carruth2013-08-221-49/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | using GEPs. Previously, it used a number of different heuristics for analyzing the GEPs. Several of these were conservatively correct, but failed to fall back to SCEV even when SCEV might have given a reasonable answer. One was simply incorrect in how it was formulated. There was good code already to recursively evaluate the constant offsets in GEPs, look through pointer casts, etc. I gathered this into a form code like the SLP code can use in a previous commit, which allows all of this code to become quite simple. There is some performance (compile time) concern here at first glance as we're directly attempting to walk both pointers constant GEP chains. However, a couple of thoughts: 1) The very common cases where there is a dynamic pointer, and a second pointer at a constant offset (usually a stride) from it, this code will actually not do any unnecessary work. 2) InstCombine and other passes work very hard to collapse constant GEPs, so it will be rare that we iterate here for a long time. That said, if there remain performance problems here, there are some obvious things that can improve the situation immensely. Doing a vectorizer-pass-wide memoizer for each individual layer of pointer values, their base values, and the constant offset is likely to be able to completely remove redundant work and strictly limit the scaling of the work to scrape these GEPs. Since this optimization was not done on the prior version (which would still benefit from it), I've not done it here. But if folks have benchmarks that slow down it should be straight forward for them to add. I've added a test case, but I'm not really confident of the amount of testing done for different access patterns, strides, and pointer manipulation. llvm-svn: 189007
* Teach LoopVectorize about address space sizesMatt Arsenault2013-08-221-1/+2
| | | | llvm-svn: 188980
* Fixed typo.Michael Gottesman2013-08-211-1/+1
| | | | llvm-svn: 188957
* Removed trailing whitespace.Michael Gottesman2013-08-211-13/+13
| | | | llvm-svn: 188956
* No functionality change.Yunzhong Gao2013-08-211-2/+2
| | | | | | Replace "(255 & value)" with "(0xFF & value)" to improve clarity. llvm-svn: 188941
* Teach InstCombine about address spacesMatt Arsenault2013-08-212-21/+33
| | | | llvm-svn: 188926
* Use attribute helper functionMatt Arsenault2013-08-211-2/+1
| | | | llvm-svn: 188916
* Fix typoMatt Arsenault2013-08-211-1/+1
| | | | llvm-svn: 188915
* Move registering the execution of a basic block to the beginning rather than ↵Bill Wendling2013-08-201-7/+7
| | | | | | | | | | | | | | | | | the end. There are situations which can affect the correctness (or at least expectation) of the gcov output. For instance, if a call to __gcov_flush() occurs within a block before the execution count is registered and then the program aborts in some way, then that block will not be marked as executed. This is not normally what the user expects. If we move the code that's registering when a block is executed to the beginning, we can catch these types of situations. PR16893 llvm-svn: 188849
* SLPVectorizer: Fix invalid iterator errorsArnold Schwaighofer2013-08-201-13/+51
| | | | | | | | | | | Update iterator when the SLP vectorizer changes the instructions in the basic block by restarting the traversal of the basic block. Patch by Yi Jiang! Fixes PR 16899. llvm-svn: 188832
* Add a llvm.copysign intrinsicHal Finkel2013-08-191-0/+5
| | | | | | | | | | | | | | | | | | | | | This adds a llvm.copysign intrinsic; We already have Libfunc recognition for copysign (which is turned into the FCOPYSIGN SDAG node). In order to autovectorize calls to copysign in the loop vectorizer, we need a corresponding intrinsic as well. In addition to the expected changes to the language reference, the loop vectorizer, BasicTTI, and the SDAG builder (the intrinsic is transformed into an FCOPYSIGN node, just like the function call), this also adds FCOPYSIGN to a few lists in LegalizeVector{Ops,Types} so that vector copysigns can be expanded. In TargetLoweringBase::initActions, I've made the default action for FCOPYSIGN be Expand for vector types. This seems correct for all in-tree targets, and I think is the right thing to do because, previously, there was no way to generate vector-values FCOPYSIGN nodes (and most targets don't specify an action for vector-typed FCOPYSIGN). llvm-svn: 188728
* Use pop_back_val() instead of both back() and pop_back().Jakub Staszak2013-08-191-2/+1
| | | | llvm-svn: 188723
* Teach InstCombine visitGetElementPtr about address spacesMatt Arsenault2013-08-193-20/+26
| | | | llvm-svn: 188721
* Cleanup visitGetElementPtr to make address space change easierMatt Arsenault2013-08-191-11/+13
| | | | llvm-svn: 188720
* commonPointerCast cleanups to make address space change easierMatt Arsenault2013-08-191-5/+11
| | | | llvm-svn: 188719
* Revert non-test parts of r188507Matt Arsenault2013-08-191-1/+9
| | | | | | Re-add the inboundsless tests I didn't add originally llvm-svn: 188710
* Introduce SpecialCaseList::isIn overload for GlobalAliases.Peter Collingbourne2013-08-191-2/+14
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D1437 llvm-svn: 188688
* Adds missing TLI check for library simplification ofMichael Kuperstein2013-08-191-3/+6
| | | | | | | * pow(x, 0.5) -> fabs(sqrt(x)) * pow(2.0, x) -> exp2(x) llvm-svn: 188656
* Remove SpecialCaseList::findCategory.Peter Collingbourne2013-08-191-35/+0
| | | | | | It turned out that I didn't need this for DFSan. llvm-svn: 188646
* PR 16899: Do not modify the basic block using the iterator, but keep theJoerg Sonnenberger2013-08-171-4/+6
| | | | | | | | next value. This avoids crashes due to invalidation. Patch by Joey Gouly. llvm-svn: 188605
* InstCombine: Use isAllOnesValue() instead of explicit -1.Jim Grosbach2013-08-161-1/+1
| | | | llvm-svn: 188563
* InstCombine: Simplify if(x!=0 && x!=-1).Jim Grosbach2013-08-161-1/+6
| | | | | | | | | | | When both constants are positive or both constants are negative, InstCombine already simplifies comparisons like this, but when it's exactly zero and -1, the operand sorting ends up reversed and the pattern fails to match. Handle that special case. Follow up for rdar://14689217 llvm-svn: 188512
* Don't do FoldCmpLoadFromIndexedGlobal for non inbounds GEPsMatt Arsenault2013-08-151-9/+2
| | | | | | | This path wasn't tested before without a datalayout, so add some more tests and re-run with and without one. llvm-svn: 188507
* Fix spellingMatt Arsenault2013-08-151-2/+2
| | | | llvm-svn: 188506
OpenPOWER on IntegriCloud