summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Spelling fix: consequtive -> consecutive.Duncan Sands2011-02-151-1/+1
| | | | llvm-svn: 125563
* Actually check memcpy lengths, instead of just commenting aboutDan Gohman2011-01-211-2/+4
| | | | | | how they should be checked. llvm-svn: 123999
* revert 123144, reenabling the rest of memset formation.Chris Lattner2011-01-121-3/+0
| | | | llvm-svn: 123302
* revert r123146 which disabled code that wasn't the root causeChris Lattner2011-01-121-2/+0
| | | | | | of the bootstrap miscompare issue. llvm-svn: 123299
* revert r123149, reenabling an improvement to memcpyopt that wasn'tChris Lattner2011-01-121-4/+2
| | | | | | the source of the bootstrap problem. llvm-svn: 123298
* another random stab in the dark trying to fix llvm-gcc-i386-linux-selfhostChris Lattner2011-01-101-2/+4
| | | | llvm-svn: 123149
* another (more) aggressive attempt to bring llvm-gcc-i386-linux-selfhostChris Lattner2011-01-101-0/+2
| | | | | | back to life. llvm-svn: 123146
* temporarily disable memset formation from memsets in an effort to restore ↵Chris Lattner2011-01-091-0/+3
| | | | | | buildbot stability. llvm-svn: 123144
* fix a few old bugs (found by inspection) where we would zap instructionsChris Lattner2011-01-091-1/+4
| | | | | | | | without informing memdep. This could cause nondeterminstic weirdness based on where instructions happen to get allocated, and will hopefully breath some life into some broken testers. llvm-svn: 123124
* fix a latent bug in memcpyoptimizer that my recent patches exposed: it wasn't Chris Lattner2011-01-081-2/+4
| | | | | | | updating memdep when fusing stores together. This fixes the crash optimizing the bullet benchmark. llvm-svn: 123091
* tryMergingIntoMemset can only handle constant length memsets.Chris Lattner2011-01-081-5/+6
| | | | llvm-svn: 123090
* Merge memsets followed by neighboring memsets and other stores intoChris Lattner2011-01-081-3/+18
| | | | | | | | | | | | | | | | larger memsets. Among other things, this fixes rdar://8760394 and allows us to handle "Example 2" from http://blog.regehr.org/archives/320, compiling it into a single 4096-byte memset: _mad_synth_mute: ## @mad_synth_mute ## BB#0: ## %entry pushq %rax movl $4096, %esi ## imm = 0x1000 callq ___bzero popq %rax ret llvm-svn: 123089
* fix an issue in IsPointerOffset that prevented us from recognizing thatChris Lattner2011-01-081-3/+19
| | | | | | P and P+1 are relative to the same base pointer. llvm-svn: 123087
* enhance memcpyopt to merge a store and a subsequentChris Lattner2011-01-081-53/+83
| | | | | | memset into a single larger memset. llvm-svn: 123086
* constify TargetData references.Chris Lattner2011-01-081-86/+96
| | | | | | | Split memset formation logic out into its own "tryMergingIntoMemset" helper function. llvm-svn: 123081
* start using irbuilder to make mem intrinsics in a few passes.Chris Lattner2010-12-261-59/+20
| | | | llvm-svn: 122572
* move isBytewiseValue out to ValueTracking.h/cppChris Lattner2010-12-261-68/+1
| | | | llvm-svn: 122565
* Simplify code.Benjamin Kramer2010-12-261-1/+1
| | | | llvm-svn: 122561
* Fix a thinko pointed out by Frits van Bommel: looking through global ↵Benjamin Kramer2010-12-241-22/+19
| | | | | | variables in isBytewiseValue is not safe. llvm-svn: 122550
* MemCpyOpt: Turn memcpys from a constant into a memset if possible.Benjamin Kramer2010-12-241-3/+45
| | | | | | | | | | | | | This allows us to compile "int cst[] = {-1, -1, -1};" into movl $-1, 16(%rsp) movq $-1, 8(%rsp) instead of movl _cst+8(%rip), %eax movl %eax, 16(%rsp) movq _cst(%rip), %rax movq %rax, 8(%rsp) llvm-svn: 122548
* Change all self assignments X=X to (void)X, so that we can turn on aJeffrey Yasskin2010-12-231-4/+1
| | | | | | | new gcc warning that complains on self-assignments and self-initializations. llvm-svn: 122458
* Make memcpyopt TBAA-aware.Dan Gohman2010-12-161-12/+4
| | | | llvm-svn: 121944
* enhance memcpyopt to zap memcpy's that have the same src/dst.Chris Lattner2010-12-091-4/+13
| | | | llvm-svn: 121362
* fix PR8753, eliminating a case where we'd infinitely make a Chris Lattner2010-12-091-0/+8
| | | | | | | substitution because it doesn't actually change the IR. Patch by Jakub Staszak! llvm-svn: 121361
* PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() andJay Foad2010-12-071-2/+2
| | | | | | | | zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method trunc(), to be const and to return a new value instead of modifying the object in place. llvm-svn: 121120
* fix a bozo bug I introduced in r119930, causing a miscompile ofChris Lattner2010-12-011-1/+2
| | | | | | | 20040709-1.c from the gcc testsuite. I was using the size of a pointer instead of the pointee. This fixes rdar://8713376 llvm-svn: 120519
* prune an llvmcontext include and simplify some code.Chris Lattner2010-11-291-6/+3
| | | | llvm-svn: 120347
* fix commentChris Lattner2010-11-211-1/+0
| | | | llvm-svn: 119948
* rework some DSE paths to use the newly-public "getPointerDependencyFrom"Chris Lattner2010-11-211-46/+37
| | | | | | | method in MemDep instead of inserting an instruction, doing a query, then removing it. Neither operation is effectively cached. llvm-svn: 119930
* Implement PR8644: forwarding a memcpy value to a byval,Chris Lattner2010-11-211-44/+127
| | | | | | | | | | | | allowing the memcpy to be eliminated. Unfortunately, the requirements on byval's without explicit alignment are really weak and impossible to predict in the mid-level optimizer, so this doesn't kick in much with current frontends. The fix is to change clang to set alignment on all byval arguments. llvm-svn: 119916
* Simplify code. No change in functionality.Benjamin Kramer2010-11-201-1/+1
| | | | llvm-svn: 119908
* slightly simplify code and substantially improve comment. Instead of Chris Lattner2010-11-181-20/+23
| | | | | | saying "it would be bad", give an example of what is going on. llvm-svn: 119695
* remove a pointless restriction from memcpyopt. It wasChris Lattner2010-11-181-4/+7
| | | | | | | | | | | | refusing to optimize two memcpy's like this: copy A <- B copy C <- A if it couldn't prove that noalias(B,C). We can eliminate the copy by producing a memmove instead of memcpy. llvm-svn: 119694
* remove another pointless noalias check: M is a memcpy, so theChris Lattner2010-11-181-2/+1
| | | | | | source and dest are known to not overlap. llvm-svn: 119692
* use AA::isNoAlias instead of open coding it. Remove an extraneous noalias ↵Chris Lattner2010-11-181-11/+7
| | | | | | | | | check: there is no need to check to see if the source and dest of a memcpy are noalias, behavior is undefined if not. llvm-svn: 119691
* rearrange some code, splitting memcpy/memcpy optimizationChris Lattner2010-11-181-45/+56
| | | | | | out of processMemCpy into its own function. llvm-svn: 119687
* Reapply r116831 and r116839, converting AliasAnalysis to useDan Gohman2010-10-191-1/+1
| | | | | | uint64_t, plus fixes for places I missed before. llvm-svn: 116875
* Revert r116831 and r116839, which are breaking selfhost builds.Dan Gohman2010-10-191-1/+1
| | | | llvm-svn: 116858
* Oops, check in all the files for converting AliasAnalysis toDan Gohman2010-10-191-1/+1
| | | | | | use uint64_t. llvm-svn: 116839
* Get rid of static constructors for pass registration. Instead, every pass ↵Owen Anderson2010-10-191-1/+3
| | | | | | | | | | | | | | | | | exposes an initializeMyPassFunction(), which must be called in the pass's constructor. This function uses static dependency declarations to recursively initialize the pass's dependencies. Clients that only create passes through the createFooPass() APIs will require no changes. Clients that want to use the CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h before parsing commandline arguments. I have tested this with all standard configurations of clang and llvm-gcc on Darwin. It is possible that there are problems with the static dependencies that will only be visible with non-standard options. If you encounter any crash in pass registration/creation, please send the testcase to me directly. llvm-svn: 116820
* Consistently use AliasAnalysis::UnknownSize instead of hardcoding ~0u.Dan Gohman2010-10-191-1/+1
| | | | llvm-svn: 116815
* Generalize MemCpyOpt's handling of call slot forwarding to function properly ↵Owen Anderson2010-10-151-18/+48
| | | | | | | | when the call slot forwarding is implemented with a load/store pair rather than a memcpy. llvm-svn: 116637
* Begin adding static dependence information to passes, which will allow us toOwen Anderson2010-10-121-2/+7
| | | | | | | | | perform initialization without static constructors AND without explicit initialization by the client. For the moment, passes are required to initialize both their (potential) dependencies and any passes they preserve. I hope to be able to relax the latter requirement in the future. llvm-svn: 116334
* Now with fewer extraneous semicolons!Owen Anderson2010-10-071-1/+1
| | | | llvm-svn: 115996
* Fix the other half of the alignment changing issue by making sure that theEric Christopher2010-10-011-3/+8
| | | | | | | | memcpy alignment is the minimum of the incoming alignments. Fixes PR 8266. llvm-svn: 115305
* If we're changing the source of a memcpy we need to use the alignmentEric Christopher2010-09-251-3/+5
| | | | | | | | | of the source, not the original alignment since it may no longer be valid. Fixes rdar://8400094 llvm-svn: 114781
* Reapply r110396, with fixes to appease the Linux buildbot gods.Owen Anderson2010-08-061-1/+1
| | | | llvm-svn: 110460
* Revert r110396 to fix buildbots.Owen Anderson2010-08-061-1/+1
| | | | llvm-svn: 110410
* Don't use PassInfo* as a type identifier for passes. Instead, use the ↵Owen Anderson2010-08-051-1/+1
| | | | | | | | address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. llvm-svn: 110396
* simplify by using CallSite constructors; virtually eliminates CallSite::get ↵Gabor Greif2010-07-281-5/+6
| | | | | | from the tree llvm-svn: 109687
OpenPOWER on IntegriCloud