summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Move the capture analysis from MemoryDependencyAnalysis to a more general placeChad Rosier2012-05-141-1/+5
| | | | | | | | | 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 llvm-svn: 156776
* Fix various issues (or do cleanups) found by enabling certain MSVC warnings.Ahmed Charles2012-02-131-3/+2
| | | | | | | | | - Use unsigned literals when the desired result is unsigned. This mostly allows unsigned/signed mismatch warnings to be less noisy even if they aren't on by default. - Remove misplaced llvm_unreachable. - Add static to a declaration of a function on MSVC x86 only. - Change some instances of calling a static function through a variable to simply calling that function while removing the unused variable. llvm-svn: 150364
* Update comment.Chad Rosier2011-12-051-1/+1
| | | | llvm-svn: 145866
* Make the MemCpyOptimizer a bit more aggressive. I can't think of a scenerioChad Rosier2011-12-051-1/+1
| | | | | | | | where this would be bad as the backend shouldn't have a problem inlining small memcpys. rdar://10510150 llvm-svn: 145865
* Refactor code to use new attribute getters on CallSite for NoCapture and ByVal.Nick Lewycky2011-11-201-1/+1
| | | | | | | | Suggested in code review by Eli. That code in InstCombine looks kinda suspicious. llvm-svn: 145013
* When looking for dependencies on the src pointer, scan the src pointer. ScanningNick Lewycky2011-10-161-12/+17
| | | | | | on the memcpy call will pull up other unrelated stuff. Fixes PR11142. llvm-svn: 142150
* Add missing space.Nick Lewycky2011-10-121-1/+1
| | | | llvm-svn: 141750
* Atomic load/store handling for the passes using memdep (GVN, DSE, memcpyopt).Eli Friedman2011-08-171-3/+3
| | | | llvm-svn: 137888
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-181-4/+4
| | | | llvm-svn: 135375
* Change Intrinsic::getDeclaration and friends to take an ArrayRef.Benjamin Kramer2011-07-141-1/+1
| | | | llvm-svn: 135154
* Second attempt at de-constifying LLVM Types in FunctionType::get(),Jay Foad2011-07-121-3/+3
| | | | | | StructType::get() and TargetData::getIntPtrType(). llvm-svn: 134982
* Revert r134893 and r134888 (and related patches in other trees). It was causingBill Wendling2011-07-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | an assert on Darwin llvm-gcc builds. Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create, file /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.llvm-gcc-i386-darwin9-RA/llvm.src/lib/VMCore/Instructions.cpp, li\ ne 2067. etc. http://smooshlab.apple.com:8013/builders/llvm-gcc-i386-darwin9-RA/builds/2354 --- Reverse-merging r134893 into '.': U include/llvm/Target/TargetData.h U include/llvm/DerivedTypes.h U tools/bugpoint/ExtractFunction.cpp U unittests/Support/TypeBuilderTest.cpp U lib/Target/ARM/ARMGlobalMerge.cpp U lib/Target/TargetData.cpp U lib/VMCore/Constants.cpp U lib/VMCore/Type.cpp U lib/VMCore/Core.cpp U lib/Transforms/Utils/CodeExtractor.cpp U lib/Transforms/Instrumentation/ProfilingUtils.cpp U lib/Transforms/IPO/DeadArgumentElimination.cpp U lib/CodeGen/SjLjEHPrepare.cpp --- Reverse-merging r134888 into '.': G include/llvm/DerivedTypes.h U include/llvm/Support/TypeBuilder.h U include/llvm/Intrinsics.h U unittests/Analysis/ScalarEvolutionTest.cpp U unittests/ExecutionEngine/JIT/JITTest.cpp U unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp U unittests/VMCore/PassManagerTest.cpp G unittests/Support/TypeBuilderTest.cpp U lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp U lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp U lib/VMCore/IRBuilder.cpp G lib/VMCore/Type.cpp U lib/VMCore/Function.cpp G lib/VMCore/Core.cpp U lib/VMCore/Module.cpp U lib/AsmParser/LLParser.cpp U lib/Transforms/Utils/CloneFunction.cpp G lib/Transforms/Utils/CodeExtractor.cpp U lib/Transforms/Utils/InlineFunction.cpp U lib/Transforms/Instrumentation/GCOVProfiling.cpp U lib/Transforms/Scalar/ObjCARC.cpp U lib/Transforms/Scalar/SimplifyLibCalls.cpp U lib/Transforms/Scalar/MemCpyOptimizer.cpp G lib/Transforms/IPO/DeadArgumentElimination.cpp U lib/Transforms/IPO/ArgumentPromotion.cpp U lib/Transforms/InstCombine/InstCombineCompares.cpp U lib/Transforms/InstCombine/InstCombineAndOrXor.cpp U lib/Transforms/InstCombine/InstCombineCalls.cpp U lib/CodeGen/DwarfEHPrepare.cpp U lib/CodeGen/IntrinsicLowering.cpp U lib/Bitcode/Reader/BitcodeReader.cpp llvm-svn: 134949
* De-constify Types in FunctionType::get().Jay Foad2011-07-111-3/+3
| | | | llvm-svn: 134888
* Stop using memdep for a check that didn't really make sense with memdep. In ↵Eli Friedman2011-06-151-11/+9
| | | | | | terms of specific issues, using memdep here checks irrelevant instructions and won't work properly once we start returning "unknown" more aggressively from memdep. llvm-svn: 133035
* Add "unknown" results for memdep, which mean "I don't know whether a ↵Eli Friedman2011-06-151-1/+1
| | | | | | dependence for the given instruction exists in the given block". This cleans up all the existing hacks in memdep which represent this concept by returning clobber with various unrelated instructions. llvm-svn: 133031
* PR10067: Add missing safety check to call return transformation in ↵Eli Friedman2011-06-021-4/+21
| | | | | | MemCpyOpt::processStore. If something accesses the dest of the "copy" between the call and the copy, the performCallSlotOptzn transformation is not valid. llvm-svn: 132485
* Teach valuetracking that byval arguments with a specified alignment areChris Lattner2011-05-231-5/+10
| | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 131884
* Preserve line number info.Devang Patel2011-05-041-1/+4
| | | | llvm-svn: 130876
* enhance memcpyopt to obey -fno-builtin and friends. This addresses aChris Lattner2011-05-011-0/+17
| | | | | | problem reported on cfe-dev. llvm-svn: 130661
* Fix a ton of comment typos found by codespell. Patch byChris Lattner2011-04-151-1/+1
| | | | | | Luis Felipe Strano Moraes! llvm-svn: 129558
* 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
OpenPOWER on IntegriCloud