summaryrefslogtreecommitdiff
path: root/lib/Transforms
Commit message (Collapse)AuthorAge
* 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
* Delete a stale comment. No functional change.Meador Inge2012-11-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167698 91177308-0d34-0410-b5e6-96231b3b80d8
* instcombine: Migrate memset optimizationsMeador Inge2012-11-11
| | | | | | | This patch migrates the memset optimizations from the simplify-libcalls pass into the instcombine library call simplifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167689 91177308-0d34-0410-b5e6-96231b3b80d8
* instcombine: Migrate memmove optimizationsMeador Inge2012-11-11
| | | | | | | This patch migrates the memmove optimizations from the simplify-libcalls pass into the instcombine library call simplifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167687 91177308-0d34-0410-b5e6-96231b3b80d8
* instcombine: Migrate memcpy optimizationsMeador Inge2012-11-11
| | | | | | | This patch migrates the memcpy optimizations from the simplify-libcalls pass into the instcombine library call simplifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167686 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
* instcombine: Migrate memcmp optimizationsMeador Inge2012-11-11
| | | | | | | This patch migrates the memcmp optimizations from the simplify-libcalls pass into the instcombine library call simplifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167683 91177308-0d34-0410-b5e6-96231b3b80d8
* instcombine: Migrate strstr optimizationsMeador Inge2012-11-11
| | | | | | | This patch migrates the strstr optimizations from the simplify-libcalls pass into the instcombine library call simplifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167682 91177308-0d34-0410-b5e6-96231b3b80d8
* Add method for replacing instructions to LibCallSimplifierMeador Inge2012-11-11
| | | | | | | | | | | | | | | In some cases the library call simplifier may need to replace instructions other than the library call being simplified. In those cases it may be necessary for clients of the simplifier to override how the replacements are actually done. As such, a new overrideable method for replacing instructions was added to LibCallSimplifier. A new subclass of LibCallSimplifier is also defined which overrides the instruction replacement method. This is because the instruction combiner defines its own replacement method which updates the worklist when instructions are replaced. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167681 91177308-0d34-0410-b5e6-96231b3b80d8
* instcombine: Migrate strcspn optimizationsMeador Inge2012-11-10
| | | | | | | This patch migrates the strcspn optimizations from the simplify-libcalls pass into the instcombine library call simplifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167675 91177308-0d34-0410-b5e6-96231b3b80d8
* instcombine: Query target library information to gate libcall simplificationsMeador Inge2012-11-10
| | | | | | | | | Several of the simplifiers migrated from the simplify-libcalls pass to the instcombine pass were not correctly checking the target library information to gate the simplifications. This patch ensures that the check is made. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167660 91177308-0d34-0410-b5e6-96231b3b80d8
* tsan: switch to new memory_order constants (ABI compatible)Dmitry Vyukov2012-11-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167615 91177308-0d34-0410-b5e6-96231b3b80d8
* tsan: instrument all atomics (including fetch_add, exchange, cas, etc)Dmitry Vyukov2012-11-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167612 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
* instcombine: Migrate strspn optimizationsMeador Inge2012-11-08
| | | | | | | This patch migrates the strspn optimizations from the simplify-libcalls pass into the instcombine library call simplifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167568 91177308-0d34-0410-b5e6-96231b3b80d8
* Only do switch-to-lookup table transformation when TargetTransformInfoHans Wennborg2012-11-07
| | | | | | is available. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167552 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] fix bug 14277 (asan needs to fail with fata error if an __asan ↵Kostya Serebryany2012-11-07
| | | | | | interface function is being redefined. Before this fix asan asserts) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167529 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize the transform that boosts GEP indices to the size of a pointer toDuncan Sands2012-11-03
| | | | | | | also do it for vectors of pointers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167354 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix whitespacesAlexey Samsonov2012-11-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167295 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert the switch of loop-idiom to use the new dependence analysis.Chandler Carruth2012-11-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new analysis is not yet ready for prime time. It has a *critical* flawed assumption, and some troubling shortages of testing. Until it's been hammered into better shape, let's stick with the working code. This should be easy to revert itself when the analysis is ready. Fixes PR14241, a miscompile of any memcpy-able loop which uses a pointer as the induction mechanism. If you have been seeing miscompiles in this revision range, you really want to test with this backed out. The results of this miscompile are a bit subtle as they can lead to downstream passes concluding things are impossible which are in fact possible. Thanks to David Blaikie for the majority of the reduction of this miscompile. I'll be checking in the test case in a non-revert commit. Revesions reverted here: r167045: LoopIdiom: Fix a serious missed optimization: we only turned top-level loops into memmove. r166877: LoopIdiom: Add checks to avoid turning memmove into an infinite loop. r166875: LoopIdiom: Recognize memmove loops. r166874: LoopIdiom: Replace custom dependence analysis with DependenceAnalysis. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167286 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an obvious typo that causes an assertion failure when runningDuncan Sands2012-11-02
| | | | | | | | test/Transforms/GVN/rle.ll if the (currently disabled) check for a pointer type in getIntPtrType is turned on. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167285 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
* [asan] don't instrument globals that we've created ourselves (reduces the ↵Kostya Serebryany2012-11-01
| | | | | | binary size a bit) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167230 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert the majority of the next patch in the address space series:Chandler Carruth2012-11-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r165941: Resubmit the changes to llvm core to update the functions to support different pointer sizes on a per address space basis. Despite this commit log, this change primarily changed stuff outside of VMCore, and those changes do not carry any tests for correctness (or even plausibility), and we have consistently found questionable or flat out incorrect cases in these changes. Most of them are probably correct, but we need to devise a system that makes it more clear when we have handled the address space concerns correctly, and ideally each pass that gets updated would receive an accompanying test case that exercises that pass specificaly w.r.t. alternate address spaces. However, from this commit, I have retained the new C API entry points. Those were an orthogonal change that probably should have been split apart, but they seem entirely good. In several places the changes were very obvious cleanups with no actual multiple address space code added; these I have not reverted when I spotted them. In a few other places there were merge conflicts due to a cleaner solution being implemented later, often not using address spaces at all. In those cases, I've preserved the new code which isn't address space dependent. This is part of my ongoing effort to clean out the partial address space code which carries high risk and low test coverage, and not likely to be finished before the 3.2 release looms closer. Duncan and I would both like to see the above issues addressed before we return to these changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167222 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert the series of commits starting with r166578 which introduced theChandler Carruth2012-11-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | getIntPtrType support for multiple address spaces via a pointer type, and also introduced a crasher bug in the constant folder reported in PR14233. These commits also contained several problems that should really be addressed before they are re-committed. I have avoided reverting various cleanups to the DataLayout APIs that are reasonable to have moving forward in order to reduce the amount of churn, and minimize the number of commits that were reverted. I've also manually updated merge conflicts and manually arranged for the getIntPtrType function to stay in DataLayout and to be defined in a plausible way after this revert. Thanks to Duncan for working through this exact strategy with me, and Nick Lewycky for tracking down the really annoying crasher this triggered. (Test case to follow in its own commit.) After discussing with Duncan extensively, and based on a note from Micah, I'm going to continue to back out some more of the more problematic patches in this series in order to ensure we go into the LLVM 3.2 branch with a reasonable story here. I'll send a note to llvmdev explaining what's going on and why. Summary of reverted revisions: r166634: Fix a compiler warning with an unused variable. r166607: Add some cleanup to the DataLayout changes requested by Chandler. r166596: Revert "Back out r166591, not sure why this made it through since I cancelled the command. Bleh, sorry about this! r166591: Delete a directory that wasn't supposed to be checked in yet. r166578: Add in support for getIntPtrType to get the pointer type based on the address space. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167221 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
* Don't insert and erase load instruction. Simply create (new) and delete it.Jakub Staszak2012-11-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167196 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
* LCSSA: Try to recover compile time regressions due to SCEV updates.Benjamin Kramer2012-10-31
| | | | | | | | | - Use value handle tricks to communicate use replacements instead of forgetLoop, this is a lot faster. - Move the "big hammer" out of the main loop so it's not called for every instruction. This should recover most (if not all) compile time regressions introduced by this code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167136 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 fixme about unreachable cases from SwitchToLookupTableHans Wennborg2012-10-31
| | | | | | SimplifyCFG will have removed those cases for us. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167132 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
* Address Duncan's comments on r167121.Hans Wennborg2012-10-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167130 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
* Address Duncan's comments on r167115Hans Wennborg2012-10-31
| | | | | | | - Use 0 instead of NULL - Helper function for "dyn_cast, else lookup in the constant pool". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167121 91177308-0d34-0410-b5e6-96231b3b80d8
* instcombine: Migrate strto* optimizationsMeador Inge2012-10-31
| | | | | | | This patch migrates the strto* optimizations from the simplify-libcalls pass into the instcombine library call simplifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167119 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix false -> NULL conversion from r167115 spotted by Benjamin Kramer.Hans Wennborg2012-10-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167117 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace some instances of UniqueVector with SetVector, which is slightly ↵Benjamin Kramer2012-10-31
| | | | | | | | cheaper. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167116 91177308-0d34-0410-b5e6-96231b3b80d8
* Do simple constant propagation in lookup table formation for switchesHans Wennborg2012-10-31
| | | | | | | | | | | | | | | | | | | By propagating the value for the switch condition, LLVM can now build lookup tables for code such as: switch (x) { case 1: return 5; case 2: return 42; case 3: case 4: case 5: return x - 123; default: return 123; } Given that x is known for each case, "x - 123" becomes a constant for cases 3, 4, and 5. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167115 91177308-0d34-0410-b5e6-96231b3b80d8
* LCSSA: Add a workaround for another nasty SCEV cache invalidation issue.Benjamin Kramer2012-10-31
| | | | | | | I'm not entirely happy with this solution, but I don't see a smarter way currently. Fixes PR14214. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167112 91177308-0d34-0410-b5e6-96231b3b80d8
* instcombine: Migrate strpbrk optimizationsMeador Inge2012-10-31
| | | | | | | This patch migrates the strpbrk optimizations from the simplify-libcalls pass into the instcombine library call simplifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167105 91177308-0d34-0410-b5e6-96231b3b80d8
* instcombine: Migrate strlen optimizationsMeador Inge2012-10-31
| | | | | | | This patch migrates the strlen optimizations from the simplify-libcalls pass into the instcombine library call simplifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167103 91177308-0d34-0410-b5e6-96231b3b80d8
* instcombine: Migrate strncpy optimizationsMeador Inge2012-10-31
| | | | | | | This patch migrates the strncpy optimizations from the simplify-libcalls pass into the instcombine library call simplifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167102 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
* instcombine: Migrate stpcpy optimizationsMeador Inge2012-10-31
| | | | | | | | This patch migrates the stpcpy optimizations from the simplify-libcalls pass into the instcombine library call simplifier. Note that the __stpcpy_chk simplifications were migrated in a previous commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167083 91177308-0d34-0410-b5e6-96231b3b80d8
* instcombine: Split out the __stpcpy_chk simplifications from StrCpyChkOptMeador Inge2012-10-31
| | | | | | | | | | | | | | | | r166198 migrated the strcpy optimization to instcombine. The strcpy simplifier that was migrated from Transforms/Scalar/SimplifyLibCalls.cpp was also doing some __strcpy_chk simplifications. Those fortified simplifications were migrated as well, but introduced a bug in the __stpcpy_chk simplifier in the process. This happened because the __strcpy_chk and __stpcpy_chk simplifiers were both mapped to StrCpyChkOpt which was updated with simplifications that worked for __strcpy_chk, but not __stpcpy_chk. This patch fixes the problem by adding proper test coverage and creating a new simplifier for __stpcpy_chk (instead of sharing one with __strcpy_chk). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167082 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
* Fix PR14212: For some strange reason I treated vectors differently fromChandler Carruth2012-10-30
| | | | | | | | | integers in that the code to handle split alloca-wide integer loads or stores doesn't come first. It should, for the same reasons as with integers, and the PR attests to that. Also had to fix a busted assert in that this test case also covers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167051 91177308-0d34-0410-b5e6-96231b3b80d8