summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Don't remove volatile loads. Thanks to Duncan for noticing this one.Owen Anderson2008-07-281-1/+1
| | | | llvm-svn: 54144
* Add support for eliminating stores that store the same value that was just ↵Owen Anderson2008-07-281-2/+35
| | | | | | | | loaded. This fixes PR2599. llvm-svn: 54133
* 80 col / tabs fixesNate Begeman2008-05-131-2/+2
| | | | llvm-svn: 51021
* Clean up the use of static and anonymous namespaces. This turned upDan Gohman2008-05-131-2/+3
| | | | | | | several things that were neither in an anonymous namespace nor static but not intended to be global. llvm-svn: 51017
* Fix DSE to not eliminate volatile loads with no uses.Dan Gohman2008-04-281-3/+3
| | | | llvm-svn: 50370
* Be more precise when eliminating pointers bue to memcpy's. This allows moreOwen Anderson2008-02-041-4/+10
| | | | | | stores to be deleted in some cases. llvm-svn: 46694
* Remove a couple more cases of "getNumUses() == 0". No need to walk the linkedNick Lewycky2008-01-301-2/+2
| | | | | | list just to see if whether the list is empty. llvm-svn: 46555
* Use empty() instead of comparing size() with zero.Nick Lewycky2008-01-301-1/+1
| | | | llvm-svn: 46554
* Don't DCE FreeInst's. We were using those! Patch from Owen Anderson.Nick Lewycky2008-01-301-1/+1
| | | | llvm-svn: 46553
* Make DSE much more aggressive by performing DCE earlier. Update a testcase ↵Owen Anderson2008-01-301-2/+55
| | | | | | to reflect this increased aggressiveness. llvm-svn: 46542
* Add support for eliminating memcpy's at the end of functions. Also fix some ↵Owen Anderson2008-01-291-26/+63
| | | | | | | | errors I noticed in the handling of eliminating stores to byval arguments. llvm-svn: 46494
* DeadStoreElimination can treat byval parameters as if there were alloca's ↵Owen Anderson2008-01-251-5/+6
| | | | | | for the purpose of removing end-of-function stores. llvm-svn: 46351
* Initializing an unsigned with ~0UL causes the compilerDuncan Sands2008-01-201-9/+9
| | | | | | to complain on x86-64 (gcc 4.1). Use ~0U instead. llvm-svn: 46197
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | llvm-svn: 45418
* Integrate the readonly/readnone logic more deeplyDuncan Sands2007-12-011-2/+1
| | | | | | | | | | | | | | | into alias analysis. This meant updating the API which now has versions of the getModRefBehavior, doesNotAccessMemory and onlyReadsMemory methods which take a callsite parameter. These should be used unless the callsite is not known, since in general they can do a better job than the versions that take a function. Also, users should no longer call the version of getModRefBehavior that takes both a function and a callsite. To reduce the chance of misuse it is now protected. llvm-svn: 44487
* don't put erase or query for non-allocainst pointers in an set of allocainsts*'sChris Lattner2007-11-061-3/+6
| | | | llvm-svn: 43779
* Executive summary: getTypeSize -> getTypeStoreSize / getABITypeSize.Duncan Sands2007-11-011-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The meaning of getTypeSize was not clear - clarifying it is important now that we have x86 long double and arbitrary precision integers. The issue with long double is that it requires 80 bits, and this is not a multiple of its alignment. This gives a primitive type for which getTypeSize differed from getABITypeSize. For arbitrary precision integers it is even worse: there is the minimum number of bits needed to hold the type (eg: 36 for an i36), the maximum number of bits that will be overwriten when storing the type (40 bits for i36) and the ABI size (i.e. the storage size rounded up to a multiple of the alignment; 64 bits for i36). This patch removes getTypeSize (not really - it is still there but deprecated to allow for a gradual transition). Instead there is: (1) getTypeSizeInBits - a number of bits that suffices to hold all values of the type. For a primitive type, this is the minimum number of bits. For an i36 this is 36 bits. For x86 long double it is 80. This corresponds to gcc's TYPE_PRECISION. (2) getTypeStoreSizeInBits - the maximum number of bits that is written when storing the type (or read when reading it). For an i36 this is 40 bits, for an x86 long double it is 80 bits. This is the size alias analysis is interested in (getTypeStoreSize returns the number of bytes). There doesn't seem to be anything corresponding to this in gcc. (3) getABITypeSizeInBits - this is getTypeStoreSizeInBits rounded up to a multiple of the alignment. For an i36 this is 64, for an x86 long double this is 96 or 128 depending on the OS. This is the spacing between consecutive elements when you form an array out of this type (getABITypeSize returns the number of bytes). This is TYPE_SIZE in gcc. Since successive elements in a SequentialType (arrays, pointers and vectors) need to be aligned, the spacing between them will be given by getABITypeSize. This means that the size of an array is the length times the getABITypeSize. It also means that GEP computations need to use getABITypeSize when computing offsets. Furthermore, if an alloca allocates several elements at once then these too need to be aligned, so the size of the alloca has to be the number of elements multiplied by getABITypeSize. Logically speaking this doesn't have to be the case when allocating just one element, but it is simpler to also use getABITypeSize in this case. So alloca's and mallocs should use getABITypeSize. Finally, since gcc's only notion of size is that given by getABITypeSize, if you want to output assembler etc the same as gcc then getABITypeSize is the size you want. Since a store will overwrite no more than getTypeStoreSize bytes, and a read will read no more than that many bytes, this is the notion of size appropriate for alias analysis calculations. In this patch I have corrected all type size uses except some of those in ScalarReplAggregates, lib/Codegen, lib/Target (the hard cases). I will get around to auditing these too at some point, but I could do with some help. Finally, I made one change which I think wise but others might consider pointless and suboptimal: in an unpacked struct the amount of space allocated for a field is now given by the ABI size rather than getTypeStoreSize. I did this because every other place that reserves memory for a type (eg: alloca) now uses getABITypeSize, and I didn't want to make an exception for unpacked structs, i.e. I did it to make things more uniform. This only effects structs containing long doubles and arbitrary precision integers. If someone wants to pack these types more tightly they can always use a packed struct. llvm-svn: 43620
* Fix test/Transforms/DeadStoreElimination/PartialStore.ll, which had beenOwen Anderson2007-11-011-4/+12
| | | | | | silently failing because of an incorrect run line for some time. llvm-svn: 43605
* Don't DSe volatile stores.Owen Anderson2007-08-261-18/+25
| | | | llvm-svn: 41456
* Make NonLocal and None const in the right way. :-)Owen Anderson2007-08-091-3/+3
| | | | llvm-svn: 40961
* Change the None and NonLocal markers in memdep to be const.Owen Anderson2007-08-081-3/+3
| | | | llvm-svn: 40946
* Global values also don't undead-ify pointers in our dead alloca's set.Owen Anderson2007-08-081-0/+3
| | | | llvm-svn: 40936
* Make handleEndBlock significantly faster with one trivial improvement,Owen Anderson2007-08-081-4/+30
| | | | | | and one hack to avoid hitting a bad case when the alias analysis is imprecise. llvm-svn: 40935
* Small improvement: if a function doesn't access memory, we don't need to scanOwen Anderson2007-08-081-2/+8
| | | | | | it for potentially undeading pointers. llvm-svn: 40933
* Add some comments, remove a dead argument, and simplify some control flow.Owen Anderson2007-08-081-19/+28
| | | | | | No functionality change. llvm-svn: 40932
* A few more small cleanups.Owen Anderson2007-08-081-9/+7
| | | | llvm-svn: 40922
* First round of cleanups from Chris' feedback.Owen Anderson2007-08-081-51/+58
| | | | llvm-svn: 40919
* Fix 80 col. violations.Owen Anderson2007-08-021-14/+23
| | | | llvm-svn: 40749
* Rename FastDSE to just DSE.Owen Anderson2007-08-011-12/+12
| | | | llvm-svn: 40668
* Move FastDSE in to DeadStoreElimination.Owen Anderson2007-08-011-0/+387
| | | | llvm-svn: 40667
* Remove old DSE.Owen Anderson2007-08-011-179/+0
| | | | llvm-svn: 40666
* Fix typo in comment.Nick Lewycky2007-05-061-1/+1
| | | | llvm-svn: 36873
* Drop 'const'Devang Patel2007-05-031-2/+2
| | | | llvm-svn: 36662
* Use 'static const char' instead of 'static const int'.Devang Patel2007-05-021-2/+2
| | | | | | | Due to darwin gcc bug, one version of darwin linker coalesces static const int, which defauts PassID based pass identification. llvm-svn: 36652
* Do not use typeinfo to identify pass in pass manager.Devang Patel2007-05-011-0/+3
| | | | llvm-svn: 36632
* Apply the VISIBILITY_HIDDEN field to the remaining anonymous classes inReid Spencer2007-02-051-1/+2
| | | | | | | the Transforms library. This reduces debug library size by 132 KB, debug binary size by 376 KB, and reduces link time for llvm tools slightly. llvm-svn: 33939
* Switch over Transforms/Scalar to use the STATISTIC macro. For each statisticChris Lattner2006-12-191-3/+4
| | | | | | | converted, we lose a static initializer. This also allows GCC to emit warnings about unused statistics. llvm-svn: 32690
* Detemplatize the Statistic class. The only type it is instantiated withChris Lattner2006-12-061-2/+2
| | | | | | is 'unsigned'. llvm-svn: 32279
* eliminate RegisterOpt. It does the same thing as RegisterPass.Chris Lattner2006-08-271-1/+1
| | | | llvm-svn: 29925
* Fix a bug where we didn't realize that vaarg reads memory. This fixesChris Lattner2005-11-301-0/+7
| | | | | | Transforms/DeadStoreElimination/2005-11-30-vaarg.ll llvm-svn: 24545
* Remove trailing whitespaceMisha Brukman2005-04-211-6/+6
| | | | llvm-svn: 21427
* Adjust to changes in instruction interfaces.Chris Lattner2005-01-291-6/+5
| | | | llvm-svn: 19900
* Fix uint64_t -> unsigned VS warnings.Chris Lattner2005-01-081-2/+2
| | | | llvm-svn: 19381
* Fix PR491 and testcase ↵Chris Lattner2004-12-291-1/+2
| | | | | | Transforms/DeadStoreElimination/2004-12-28-PartialStore.ll llvm-svn: 19180
* Make DSE potentially more aggressive by being more specific about alloca sizes.Chris Lattner2004-11-281-4/+10
| | | | llvm-svn: 18309
* Prototype these functions more accuratelyChris Lattner2004-09-201-1/+1
| | | | llvm-svn: 16432
* Changes For Bug 352Reid Spencer2004-09-011-2/+2
| | | | | | | | Move include/Config and include/Support into include/llvm/Config, include/llvm/ADT and include/llvm/Support. From here on out, all LLVM public header files must be under include/llvm/. llvm-svn: 16137
* Implement DeadStoreElim/alloca.llx by observing that allocas are dead at theChris Lattner2004-07-261-1/+4
| | | | | | end of the function (either return or unwind) llvm-svn: 15232
* * Substantially simplify how free instructions are handled (potentially fixingChris Lattner2004-07-251-43/+52
| | | | | | | | | | | a bug in DSE). * Delete dead operand uses iteratively instead of recursively, using a SetVector. * Defer deletion of dead operand uses until the end of processing, which means we don't have to bother with updating the AliasSetTracker. This speeds up DSE substantially. llvm-svn: 15204
* Free instructions kill values too. This implements DeadStoreElim/free.llxChris Lattner2004-07-251-4/+13
| | | | llvm-svn: 15199
OpenPOWER on IntegriCloud