summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Replace std::vector -> SmallVector in BBVectorizeHal Finkel2012-11-141-4/+4
| | | | | | | | | For now, this uses 8 on-stack elements. I'll need to do some profiling to see if this is the best number. Pointed out by Jakob in post-commit review. llvm-svn: 167966
* Fix the largest offender of determinism in BBVectorizeHal Finkel2012-11-141-6/+6
| | | | | | | | | | | | | | | | | Iterating over the children of each node in the potential vectorization plan must happen in a deterministic order (because it affects which children are erased when two children conflict). There was no need for this data structure to be a map in the first place, so replacing it with a vector is a small change. I believe that this was the last remaining instance if iterating over the elements of a Dense* container where the iteration order could matter. There are some remaining iterations over std::*map containers where the order might matter, but so long as the Value* for instructions in a block increase with the order of the instructions in the block (or decrease) monotonically, then this will appear to be deterministic. llvm-svn: 167942
* [TSan] fix indentationAlexey Samsonov2012-11-141-1/+1
| | | | llvm-svn: 167928
* use the getSplat API. Patch by Paul Redmond.Nadav Rotem2012-11-141-7/+1
| | | | llvm-svn: 167892
* Figure out <size> argument of llvm.lifetime intrinsics at the moment they ↵Alexey Samsonov2012-11-131-2/+21
| | | | | | are created (during function inlining) llvm-svn: 167821
* BBVectorize: Remove temporary assert used for debuggingHal Finkel2012-11-131-1/+0
| | | | llvm-svn: 167817
* instcombine: Migrate math library call simplificationsMeador Inge2012-11-133-252/+270
| | | | | | | | | | | | | | | | | This patch migrates the math library call simplifications from the simplify-libcalls pass into the instcombine library call simplifier. I have typically migrated just one simplifier at a time, but the math simplifiers are interdependent because: 1. CosOpt, PowOpt, and Exp2Opt all depend on UnaryDoubleFPOpt. 2. CosOpt, PowOpt, Exp2Opt, and UnaryDoubleFPOpt all depend on the option -enable-double-float-shrink. These two factors made migrating each of these simplifiers individually more of a pain than it would be worth. So, I migrated them all together. llvm-svn: 167815
* BBVectorize: Don't vectorize vector-manipulation chainsHal Finkel2012-11-131-0/+17
| | | | | | | | Don't choose a vectorization plan containing only shuffles and vector inserts/extracts. Due to inperfections in the cost model, these can lead to infinite recusion. llvm-svn: 167811
* revert r167740Shuxin Yang2012-11-131-314/+8
| | | | llvm-svn: 167787
* BBVectorize: Only some insert element operand pairs are free.Hal Finkel2012-11-121-13/+17
| | | | | | | | This fixes another infinite recursion case when using target costs. We can only replace insert element input chains that are pure (end with inserting into an undef). llvm-svn: 167784
* BBVectorize: Use a more sophisticated check for input costHal Finkel2012-11-121-14/+43
| | | | | | | | | The old checking code, which assumed that input shuffles and insert-elements could always be folded (and thus were free) is too simple. This can only happen in special circumstances. Using the simple check caused infinite recursion. llvm-svn: 167750
* BBVectorize: Check the types of compare instructionsHal Finkel2012-11-121-0/+2
| | | | | | | The pass would previously assert when trying to compute the cost of compare instructions with illegal vector types (like struct pointers). llvm-svn: 167743
* This change is to fix rdar://12571717 which is about assertion in ↵Shuxin Yang2012-11-121-8/+314
| | | | | | | | | | | | | | | | | | Reassociate pass. The assertion is trigged when the Reassociater tries to transform expression ... + 2 * n * 3 + 2 * m + ... into: ... + 2 * (n*3 + m). In the process of the transformation, a helper routine folds the constant 2*3 into 6, confusing optimizer which is trying the to eliminate the common factor 2, and cannot find 2 any more. Review is pending. But I'd like commit first in order to help those who are waiting for this fix. llvm-svn: 167740
* BBVectorize: Check the input types of shuffles for legalityHal Finkel2012-11-121-3/+6
| | | | | | | | | | This fixes a bug where shuffles were being fused such that the resulting input types were not legal on the target. This would occur only when both inputs and dependencies were also foldable operations (such as other shuffles) and there were other connected pairs in the same block. llvm-svn: 167731
* [ASan] fixup for r167725: Don't fetch name of StructType if it is literalAlexey Samsonov2012-11-121-2/+3
| | | | llvm-svn: 167729
* Normalize memcmp constant folding results.Meador Inge2012-11-121-1/+8
| | | | | | | | | | | | | | | | | | | The library call simplifier folds memcmp calls with all constant arguments to a constant. For example: memcmp("foo", "foo", 3) -> 0 memcmp("hel", "foo", 3) -> 1 memcmp("foo", "hel", 3) -> -1 The folding is implemented in terms of the system memcmp that LLVM gets linked with. It currently just blindly uses the value returned from the system memcmp as the folded constant. This patch normalizes the values returned from the system memcmp to (-1, 0, 1) so that we get consistent results across multiple platforms. The test cases were adjusted accordingly. llvm-svn: 167726
* [ASan]: Add minimalistic support for turning off initialization-order ↵Alexey Samsonov2012-11-122-2/+16
| | | | | | checking for globals of specified types. Tests for this behavior will go to ASan test suite in compiler-rt. llvm-svn: 167725
* Delete a stale comment. No functional change.Meador Inge2012-11-121-4/+0
| | | | llvm-svn: 167698
* instcombine: Migrate memset optimizationsMeador Inge2012-11-112-27/+21
| | | | | | | This patch migrates the memset optimizations from the simplify-libcalls pass into the instcombine library call simplifier. llvm-svn: 167689
* instcombine: Migrate memmove optimizationsMeador Inge2012-11-112-24/+22
| | | | | | | This patch migrates the memmove optimizations from the simplify-libcalls pass into the instcombine library call simplifier. llvm-svn: 167687
* instcombine: Migrate memcpy optimizationsMeador Inge2012-11-112-24/+22
| | | | | | | This patch migrates the memcpy optimizations from the simplify-libcalls pass into the instcombine library call simplifier. llvm-svn: 167686
* Fix a comment typo and add comments.Nadav Rotem2012-11-111-4/+5
| | | | llvm-svn: 167684
* instcombine: Migrate memcmp optimizationsMeador Inge2012-11-112-52/+54
| | | | | | | This patch migrates the memcmp optimizations from the simplify-libcalls pass into the instcombine library call simplifier. llvm-svn: 167683
* instcombine: Migrate strstr optimizationsMeador Inge2012-11-112-88/+83
| | | | | | | This patch migrates the strstr optimizations from the simplify-libcalls pass into the instcombine library call simplifier. llvm-svn: 167682
* Add method for replacing instructions to LibCallSimplifierMeador Inge2012-11-112-5/+34
| | | | | | | | | | | | | | | 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. llvm-svn: 167681
* instcombine: Migrate strcspn optimizationsMeador Inge2012-11-102-37/+35
| | | | | | | This patch migrates the strcspn optimizations from the simplify-libcalls pass into the instcombine library call simplifier. llvm-svn: 167675
* instcombine: Query target library information to gate libcall simplificationsMeador Inge2012-11-101-19/+25
| | | | | | | | | 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. llvm-svn: 167660
* tsan: switch to new memory_order constants (ABI compatible)Dmitry Vyukov2012-11-091-8/+7
| | | | llvm-svn: 167615
* tsan: instrument all atomics (including fetch_add, exchange, cas, etc)Dmitry Vyukov2012-11-091-8/+76
| | | | llvm-svn: 167612
* Add support for memory runtime check. When we can, we calculate array bounds.Nadav Rotem2012-11-091-33/+191
| | | | | | | 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. llvm-svn: 167608
* instcombine: Migrate strspn optimizationsMeador Inge2012-11-082-34/+32
| | | | | | | This patch migrates the strspn optimizations from the simplify-libcalls pass into the instcombine library call simplifier. llvm-svn: 167568
* Only do switch-to-lookup table transformation when TargetTransformInfoHans Wennborg2012-11-071-1/+2
| | | | | | is available. llvm-svn: 167552
* [asan] fix bug 14277 (asan needs to fail with fata error if an __asan ↵Kostya Serebryany2012-11-071-2/+3
| | | | | | interface function is being redefined. Before this fix asan asserts) llvm-svn: 167529
* Generalize the transform that boosts GEP indices to the size of a pointer toDuncan Sands2012-11-031-2/+2
| | | | | | also do it for vectors of pointers. llvm-svn: 167354
* Fix whitespacesAlexey Samsonov2012-11-021-2/+2
| | | | llvm-svn: 167295
* Revert the switch of loop-idiom to use the new dependence analysis.Chandler Carruth2012-11-021-69/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 167286
* Fix an obvious typo that causes an assertion failure when runningDuncan Sands2012-11-021-1/+1
| | | | | | | test/Transforms/GVN/rle.ll if the (currently disabled) check for a pointer type in getIntPtrType is turned on. llvm-svn: 167285
* Fix sign compare warning. Patch by Mahesha HS.Chandler Carruth2012-11-021-2/+2
| | | | llvm-svn: 167282
* BBVectorize: Use target costs for incoming and outgoing values instead of ↵Hal Finkel2012-11-011-9/+191
| | | | | | | | | | | 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. llvm-svn: 167256
* [asan] don't instrument globals that we've created ourselves (reduces the ↵Kostya Serebryany2012-11-011-3/+6
| | | | | | binary size a bit) llvm-svn: 167230
* Revert the majority of the next patch in the address space series:Chandler Carruth2012-11-016-25/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 167222
* Revert the series of commits starting with r166578 which introduced theChandler Carruth2012-11-0118-291/+275
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 167221
* BBVectorize: Account for internal shuffle costsHal Finkel2012-11-011-2/+60
| | | | | | | | | | | | | 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. llvm-svn: 167217
* Don't insert and erase load instruction. Simply create (new) and delete it.Jakub Staszak2012-11-011-2/+2
| | | | llvm-svn: 167196
* LoopVectorize: Preserve NSW, NUW and IsExact flags.Nadav Rotem2012-10-311-1/+12
| | | | llvm-svn: 167174
* LCSSA: Try to recover compile time regressions due to SCEV updates.Benjamin Kramer2012-10-311-15/+9
| | | | | | | | | - 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. llvm-svn: 167136
* Put the threshold magic number in a variable.Nadav Rotem2012-10-311-1/+4
| | | | llvm-svn: 167134
* Remove fixme about unreachable cases from SwitchToLookupTableHans Wennborg2012-10-311-2/+0
| | | | | | SimplifyCFG will have removed those cases for us. llvm-svn: 167132
* Remove enum values since they are not used anymore.Nadav Rotem2012-10-311-6/+6
| | | | llvm-svn: 167131
* Address Duncan's comments on r167121.Hans Wennborg2012-10-311-3/+4
| | | | llvm-svn: 167130
OpenPOWER on IntegriCloud