summaryrefslogtreecommitdiff
path: root/test/Transforms/MemCpyOpt
Commit message (Collapse)AuthorAge
* Treat lifetime.start'd memory like we treat freshly alloca'd memory. Patch ↵Nick Lewycky2014-03-26
| | | | | | by Björn Steinbrink! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204876 91177308-0d34-0410-b5e6-96231b3b80d8
* MemCpyOpt: When merging memsets also merge the trivial case of two memsets ↵Benjamin Kramer2014-03-10
| | | | | | | | with the same destination. The testcase is from PR19092, but I think the bug described there is actually a clang issue. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203489 91177308-0d34-0410-b5e6-96231b3b80d8
* A memcpy out of an fresh alloca is a no-op, delete it. Patch by Patrick Walton!Nick Lewycky2014-02-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200907 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle an addrspacecast case in memcpyoptMatt Arsenault2014-01-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199836 91177308-0d34-0410-b5e6-96231b3b80d8
* [tests] Cleanup initialization of test suffixes.Daniel Dunbar2013-08-16
| | | | | | | | | | | | | | | | | - Instead of setting the suffixes in a bunch of places, just set one master list in the top-level config. We now only modify the suffix list in a few suites that have one particular unique suffix (.ml, .mc, .yaml, .td, .py). - Aside from removing the need for a bunch of lit.local.cfg files, this enables 4 tests that were inadvertently being skipped (one in Transforms/BranchFolding, a .s file each in DebugInfo/AArch64 and CodeGen/PowerPC, and one in CodeGen/SI which is now failing and has been XFAILED). - This commit also fixes a bunch of config files to use config.root instead of older copy-pasted code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188513 91177308-0d34-0410-b5e6-96231b3b80d8
* Update Transforms tests to use CHECK-LABEL for easier debugging. No ↵Stephen Lin2013-07-14
| | | | | | | | | | | | | | | | | | | | | | | functionality change. This update was done with the following bash script: find test/Transforms -name "*.ll" | \ while read NAME; do echo "$NAME" if ! grep -q "^; *RUN: *llc" $NAME; then TEMP=`mktemp -t temp` cp $NAME $TEMP sed -n "s/^define [^@]*@\([A-Za-z0-9_]*\)(.*$/\1/p" < $NAME | \ while read FUNC; do sed -i '' "s/;\(.*\)\([A-Za-z0-9_]*\):\( *\)@$FUNC\([( ]*\)\$/;\1\2-LABEL:\3@$FUNC(/g" $TEMP done mv $TEMP $NAME fi done git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186268 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a potential bug in r183584.Shuxin Yang2013-06-08
| | | | | | | | | | | | | | r183584 tries to derive some info from the code *AFTER* a call and apply these derived info to the code *BEFORE* the call, which is not always safe as the call in question may never return, and in this case, the derived info is invalid. Thank Duncan for pointing out this potential bug. rdar://14073661 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183606 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an assertion in MemCpyOpt pass.Shuxin Yang2013-06-07
| | | | | | | | | | | | | | | | | | | | | | The MemCpyOpt pass is capable of optimizing: callee(&S); copy N bytes from S to D. into: callee(&D); subject to some legality constraints. Assertion is triggered when the compiler tries to evalute "sizeof(typeof(D))", while D is an opaque-typed, 'sret' formal argument of function being compiled. i.e. the signature of the func being compiled is something like this: T caller(...,%opaque* noalias nocapture sret %D, ...) The fix is that when come across such situation, instead of calling some utility functions to get the size of D's type (which will crash), we simply assume D has at least N bytes as implified by the copy-instruction. rdar://14073661 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183584 91177308-0d34-0410-b5e6-96231b3b80d8
* Use references to attribute groups on the call/invoke instructions.Bill Wendling2013-02-22
| | | | | | | | Listing all of the attributes for the callee of a call/invoke instruction is way too much and makes the IR unreadable. Use references to attributes instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175877 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify the 'operator<' for the attribute object.Bill Wendling2013-02-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175252 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Fix testcase for attribute ordering."Anna Zaks2013-02-15
| | | | | | This reverts commit 58f20a3cbfca7384fe5e25e095f18572736a4792. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175249 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Fix testcase for attribute ordering."Anna Zaks2013-02-15
| | | | | | This reverts commit 997c6516ca161073a1d516ebca7c0ca7722f64e2. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175248 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix testcase for attribute ordering.Bill Wendling2013-02-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175238 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix testcase for attribute ordering.Bill Wendling2013-02-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175236 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the AttrBuilder form of the Attribute::get creators.Bill Wendling2013-01-31
| | | | | | | | | | | | | | The AttrBuilder is for building a collection of attributes. The Attribute object holds only one attribute. So it's not really useful for the Attribute object to have a creator which takes an AttrBuilder. This has two fallouts: 1. The AttrBuilder no longer holds its internal attributes in a bit-mask form. 2. The attributes are now ordered alphabetically (hence why the tests have changed). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174110 91177308-0d34-0410-b5e6-96231b3b80d8
* In my recent change to avoid use of underaligned memory I didn't notice thatDuncan Sands2012-10-04
| | | | | | | | | cpyDest can be mutated in some cases, which would then cause a crash later if indeed the memory was underaligned. This brought down several buildbots, so I guess the underaligned case is much more common than I thought! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165228 91177308-0d34-0410-b5e6-96231b3b80d8
* The memcpy optimizer was happily doing call slot forwarding when the new memoryDuncan Sands2012-10-04
| | | | | | | | | | | was less aligned than the old. In the testcase this results in an overaligned memset: the memset alignment was correct for the original memory but is too much for the new memory. Fix this by either increasing the alignment of the new memory or bailing out if that isn't possible. Should fix the gcc-4.7 self-host buildbot failure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165220 91177308-0d34-0410-b5e6-96231b3b80d8
* MemCpyOpt: When forming a memset from stores also take GEP constexprs into ↵Benjamin Kramer2012-09-13
| | | | | | | | account. This is common when storing to global variables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163809 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the remaining TCL-style quotes found in the testsuite. This isChandler Carruth2012-07-02
| | | | | | | | | | | | | | | | | another mechanical change accomplished though the power of terrible Perl scripts. I have manually switched some "s to 's to make escaping simpler. While I started this to fix tests that aren't run in all configurations, the massive number of tests is due to a really frustrating fragility of our testing infrastructure: things like 'grep -v', 'not grep', and 'expected failures' can mask broken tests all too easily. Essentially, I'm deeply disturbed that I can change the testsuite so radically without causing any change in results for most platforms. =/ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159547 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the capture analysis from MemoryDependencyAnalysis to a more general placeChad Rosier2012-05-14
| | | | | | | | | | so that it can be reused in MemCpyOptimizer. This analysis is needed to remove an unnecessary memcpy when returning a struct into a local variable. rdar://11341081 PR12686 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156776 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace all instances of dg.exp file with lit.local.cfg, since all tests are ↵Eli Bendersky2012-02-16
| | | | | | | | | | | run with LIT now and now Dejagnu. dg.exp is no longer needed. Patch reviewed by Daniel Dunbar. It will be followed by additional cleanup patches. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150664 91177308-0d34-0410-b5e6-96231b3b80d8
* Probably not a good idea to convert a single vector load into a memcpy. WeChad Rosier2011-12-06
| | | | | | | | don't do this now, but add a test case to prevent this from happening in the future. Additional test for rdar://9892684 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145879 91177308-0d34-0410-b5e6-96231b3b80d8
* Make the MemCpyOptimizer a bit more aggressive. I can't think of a scenerioChad Rosier2011-12-05
| | | | | | | | where this would be bad as the backend shouldn't have a problem inlining small memcpys. rdar://10510150 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145865 91177308-0d34-0410-b5e6-96231b3b80d8
* Oops! Fix test I forgot to submit as part of r142735.Nick Lewycky2011-10-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142736 91177308-0d34-0410-b5e6-96231b3b80d8
* Oops! Fix testcase.Nick Lewycky2011-10-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142151 91177308-0d34-0410-b5e6-96231b3b80d8
* When looking for dependencies on the src pointer, scan the src pointer. ScanningNick Lewycky2011-10-16
| | | | | | | on the memcpy call will pull up other unrelated stuff. Fixes PR11142. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142150 91177308-0d34-0410-b5e6-96231b3b80d8
* Atomic load/store handling for the passes using memdep (GVN, DSE, memcpyopt).Eli Friedman2011-08-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137888 91177308-0d34-0410-b5e6-96231b3b80d8
* Land the long talked about "type system rewrite" patch. ThisChris Lattner2011-07-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | patch brings numerous advantages to LLVM. One way to look at it is through diffstat: 109 files changed, 3005 insertions(+), 5906 deletions(-) Removing almost 3K lines of code is a good thing. Other advantages include: 1. Value::getType() is a simple load that can be CSE'd, not a mutating union-find operation. 2. Types a uniqued and never move once created, defining away PATypeHolder. 3. Structs can be "named" now, and their name is part of the identity that uniques them. This means that the compiler doesn't merge them structurally which makes the IR much less confusing. 4. Now that there is no way to get a cycle in a type graph without a named struct type, "upreferences" go away. 5. Type refinement is completely gone, which should make LTO much MUCH faster in some common cases with C++ code. 6. Types are now generally immutable, so we can use "Type *" instead "const Type *" everywhere. Downsides of this patch are that it removes some functions from the C API, so people using those will have to upgrade to (not yet added) new API. "LLVM 3.0" is the right time to do this. There are still some cleanups pending after this, this patch is large enough as-is. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134829 91177308-0d34-0410-b5e6-96231b3b80d8
* rip out a ton of intrinsic modernization logic from AutoUpgrade.cpp, which isChris Lattner2011-06-18
| | | | | | | | | | | for pre-2.9 bitcode files. We keep x86 unaligned loads, movnt, crc32, and the target indep prefetch change. As usual, updating the testsuite is a PITA. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133337 91177308-0d34-0410-b5e6-96231b3b80d8
* make the asmparser reject function and type redefinitions. 'Merging' hasn't ↵Chris Lattner2011-06-17
| | | | | | | | | been needed since llvm-gcc 3.4 days. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133248 91177308-0d34-0410-b5e6-96231b3b80d8
* manually upgrade a bunch of tests to modern syntax, and remove some thatChris Lattner2011-06-17
| | | | | | | | are either unreduced or only test old syntax. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133228 91177308-0d34-0410-b5e6-96231b3b80d8
* PR10067: Add missing safety check to call return transformation in ↵Eli Friedman2011-06-02
| | | | | | MemCpyOpt::processStore. If something accesses the dest of the "copy" between the call and the copy, the performCallSlotOptzn transformation is not valid. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132485 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach valuetracking that byval arguments with a specified alignment areChris Lattner2011-05-23
| | | | | | | | | | | | | | | | | | | | | | | | aligned. Teach memcpyopt to not give up all hope when confonted with an underaligned memcpy feeding an overaligned byval. If the *source* of the memcpy can be determined to be adequeately aligned, or if it can be forced to be, we can eliminate the memcpy. This addresses PR9794. We now compile the example into: define i32 @f(%struct.p* nocapture byval align 8 %q) nounwind ssp { entry: %call = call i32 @g(%struct.p* byval align 8 %q) nounwind ret i32 %call } in both x86-64 and x86-32 mode. We still don't get a tailcall though, because tailcalls apparently can't handle byval. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131884 91177308-0d34-0410-b5e6-96231b3b80d8
* Actually check memcpy lengths, instead of just commenting aboutDan Gohman2011-01-21
| | | | | | | how they should be checked. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123999 91177308-0d34-0410-b5e6-96231b3b80d8
* revert 123144, reenabling the rest of memset formation.Chris Lattner2011-01-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123302 91177308-0d34-0410-b5e6-96231b3b80d8
* revert r123146 which disabled code that wasn't the root causeChris Lattner2011-01-12
| | | | | | | of the bootstrap miscompare issue. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123299 91177308-0d34-0410-b5e6-96231b3b80d8
* fix typoChris Lattner2011-01-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123148 91177308-0d34-0410-b5e6-96231b3b80d8
* another (more) aggressive attempt to bring llvm-gcc-i386-linux-selfhostChris Lattner2011-01-10
| | | | | | | back to life. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123146 91177308-0d34-0410-b5e6-96231b3b80d8
* temporarily disable memset formation from memsets in an effort to restore ↵Chris Lattner2011-01-09
| | | | | | buildbot stability. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123144 91177308-0d34-0410-b5e6-96231b3b80d8
* Merge memsets followed by neighboring memsets and other stores intoChris Lattner2011-01-08
| | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123089 91177308-0d34-0410-b5e6-96231b3b80d8
* fix an issue in IsPointerOffset that prevented us from recognizing thatChris Lattner2011-01-08
| | | | | | | P and P+1 are relative to the same base pointer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123087 91177308-0d34-0410-b5e6-96231b3b80d8
* enhance memcpyopt to merge a store and a subsequentChris Lattner2011-01-08
| | | | | | | memset into a single larger memset. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123086 91177308-0d34-0410-b5e6-96231b3b80d8
* merge two tests and filecheckifyChris Lattner2011-01-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123082 91177308-0d34-0410-b5e6-96231b3b80d8
* start using irbuilder to make mem intrinsics in a few passes.Chris Lattner2010-12-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122572 91177308-0d34-0410-b5e6-96231b3b80d8
* MemCpyOpt: Turn memcpys from a constant into a memset if possible.Benjamin Kramer2010-12-24
| | | | | | | | | | | | | | 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) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122548 91177308-0d34-0410-b5e6-96231b3b80d8
* enhance memcpyopt to zap memcpy's that have the same src/dst.Chris Lattner2010-12-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121362 91177308-0d34-0410-b5e6-96231b3b80d8
* fix PR8753, eliminating a case where we'd infinitely make a Chris Lattner2010-12-09
| | | | | | | | | substitution because it doesn't actually change the IR. Patch by Jakub Staszak! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121361 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a bozo bug I introduced in r119930, causing a miscompile ofChris Lattner2010-12-01
| | | | | | | | 20040709-1.c from the gcc testsuite. I was using the size of a pointer instead of the pointee. This fixes rdar://8713376 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120519 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement PR8644: forwarding a memcpy value to a byval,Chris Lattner2010-11-21
| | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119916 91177308-0d34-0410-b5e6-96231b3b80d8
* remove a pointless restriction from memcpyopt. It wasChris Lattner2010-11-18
| | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119694 91177308-0d34-0410-b5e6-96231b3b80d8