summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Rename getABITypeSize to getTypePaddedSize, asDuncan Sands2009-01-121-4/+4
| | | | | | suggested by Chris. llvm-svn: 62099
* don't bother touching volatile stores, they will just return clobber onChris Lattner2008-12-071-0/+5
| | | | | | everything interesting anyway. llvm-svn: 60640
* Reimplement the inner loop of DSE. It now uniformly uses getDependence(),Chris Lattner2008-12-061-84/+44
| | | | | | | | doesn't do its own local caching, and is slightly more aggressive about free/store dse (see testcase). This eliminates the last external client of MemDep::getDependenceFrom(). llvm-svn: 60619
* Make a few major changes to memdep and its clients:Chris Lattner2008-12-051-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Merge the 'None' result into 'Normal', making loads and stores return their dependencies on allocations as Normal. 2. Split the 'Normal' result into 'Clobber' and 'Def' to distinguish between the cases when memdep knows the value is produced from when we just know if may be changed. 3. Move some of the logic for determining whether readonly calls are CSEs into memdep instead of it being in GVN. This still leaves verification that the arguments are hte same to GVN to let it know about value equivalences in different contexts. 4. Change memdep's call/call dependency analysis to use getModRefInfo(CallSite,CallSite) instead of doing something very weak. This only really matters for things like DSA, but someday maybe we'll have some other decent context sensitive analyses :) 5. This reimplements the guts of memdep to handle the new results. 6. This simplifies GVN significantly: a) readonly call CSE is slightly simpler b) I eliminated the "getDependencyFrom" chaining for load elimination and load CSE doesn't have to worry about volatile (they are always clobbers) anymore. c) GVN no longer does any 'lastLoad' caching, leaving it to memdep. 7. The logic in DSE is simplified a bit and sped up. A potentially unsafe case was eliminated. llvm-svn: 60607
* Fix a thinko that manifested as a crash on clamav last night.Chris Lattner2008-11-291-2/+2
| | | | llvm-svn: 60251
* Split getDependency into getDependency and getDependencyFrom, the Chris Lattner2008-11-291-1/+1
| | | | | | | former does caching, the later doesn't. This dramatically simplifies the logic in getDependency and getDependencyFrom. llvm-svn: 60234
* Introduce and use a new MemDepResult class to hold the results of a memdepChris Lattner2008-11-291-20/+11
| | | | | | | | | | | query. This makes it crystal clear what cases can escape from MemDep that the clients have to handle. This also gives the clients a nice simplified interface to it that is easy to poke at. This patch also makes DepResultTy and MemoryDependenceAnalysis::DepType private, yay. llvm-svn: 60231
* Reimplement the internal abstraction used by MemDep in termsChris Lattner2008-11-291-15/+16
| | | | | | | | | | | | | | | of a pointer/int pair instead of a manually bitmangled pointer. This forces clients to think a little more about checking the appropriate pieces and will be useful for internal implementation improvements later. I'm not particularly happy with this. After going through this I don't think that the clients of memdep should be exposed to the internal type at all. I'll fix this in a subsequent commit. This has no functionality change. llvm-svn: 60230
* don't revisit instructions off the beginning of the block.Chris Lattner2008-11-281-2/+4
| | | | llvm-svn: 60221
* simplify some code, remove escaped newline.Chris Lattner2008-11-281-22/+28
| | | | llvm-svn: 60213
* rewrite a big chunk of how DSE does recursive dead operand Chris Lattner2008-11-281-181/+105
| | | | | | | elimination to use more modern infrastructure. Also do a bunch of small cleanups. llvm-svn: 60201
* Factorize code: remove variants of "strip offDuncan Sands2008-10-011-39/+16
| | | | | | | | | | | pointer bitcasts and GEP's", and centralize the logic in Value::getUnderlyingObject. The difference with stripPointerCasts is that stripPointerCasts only strips GEPs if all indices are zero, while getUnderlyingObject strips GEPs no matter what the indices are. llvm-svn: 56922
* Tidy up several unbeseeming casts from pointer to intptr_t.Dan Gohman2008-09-041-1/+1
| | | | llvm-svn: 55779
* 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
OpenPOWER on IntegriCloud