summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/GlobalOpt.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add the private linkage.Rafael Espindola2009-01-151-6/+6
| | | | llvm-svn: 62279
* rewrite OptimizeAwayTrappingUsesOfLoads to 1) avoid a temporaryChris Lattner2009-01-141-24/+26
| | | | | | | | vector and extraneous loop over it, 2) not delete globals used by phis/selects etc which could actually be useful. This fixes PR3321. Many thanks to Duncan for narrowing this down. llvm-svn: 62201
* Correct a comment.Duncan Sands2009-01-131-1/+1
| | | | llvm-svn: 62165
* Rename getABITypeSize to getTypePaddedSize, asDuncan Sands2009-01-121-2/+2
| | | | | | suggested by Chris. llvm-svn: 62099
* Whitespace - correct formatting.Duncan Sands2009-01-071-2/+2
| | | | llvm-svn: 61879
* insert some sequence points and preincrement an iterator to avoidChris Lattner2008-12-171-7/+8
| | | | | | iterator invalidation problems. llvm-svn: 61124
* Enhance heap sra to be substantially more aggressive w.r.t PHIChris Lattner2008-12-171-105/+182
| | | | | | | | | nodes. This allows it to do fairly general phi insertion if a load from a pointer global wants to be SRAd but the load is used by (recursive) phi nodes. This fixes a pessimization on ppc introduced by Load PRE. llvm-svn: 61123
* Fix another crash found by inspection. If we have a PHI node mergingChris Lattner2008-12-161-47/+68
| | | | | | | the load multiple times, make sure the check the uses of the PHI to ensure they are transformable. llvm-svn: 61102
* fix a crash found by inspection.Chris Lattner2008-12-161-1/+1
| | | | llvm-svn: 61101
* switch some std::set/std::map to SmallPtrSet/DenseMap.Chris Lattner2008-12-161-14/+13
| | | | llvm-svn: 61081
* enhance heap-sra to apply to fixed sized array allocations, not justChris Lattner2008-12-151-4/+43
| | | | | | variable sized array allocations. llvm-svn: 61051
* Use stripPointerCasts.Chris Lattner2008-12-151-7/+2
| | | | llvm-svn: 61047
* minor tweaks for formatting, allow bitcast in ↵Chris Lattner2008-12-151-12/+29
| | | | | | ValueIsOnlyUsedLocallyOrStoredToOneGlobal. llvm-svn: 61046
* refactor some code into a new TryToOptimizeStoreOfMallocToGlobal function.Chris Lattner2008-12-151-62/+66
| | | | | | Use GetElementPtrInst::hasAllZeroIndices where possible. llvm-svn: 61045
* Large mechanical patch.Devang Patel2008-09-251-6/+6
| | | | | | | | | | | | | | | s/ParamAttr/Attribute/g s/PAList/AttrList/g s/FnAttributeWithIndex/AttributeWithIndex/g s/FnAttr/Attribute/g This sets the stage - to implement function notes as function attributes and - to distinguish between function attributes and return value attributes. This requires corresponding changes in llvm-gcc and clang. llvm-svn: 56622
* Make safer variant of alias resolution routine to be defaultAnton Korobeynikov2008-09-091-2/+1
| | | | llvm-svn: 56005
* Resolve aliases, when possibleAnton Korobeynikov2008-09-091-0/+22
| | | | llvm-svn: 56001
* Tidy up several unbeseeming casts from pointer to intptr_t.Dan Gohman2008-09-041-1/+1
| | | | llvm-svn: 55779
* Remove tabs.Bill Wendling2008-08-121-2/+2
| | | | llvm-svn: 54707
* Make GlobalOpt preserve address spaces when scalar replacing aggregate globals.Matthijs Kooijman2008-07-171-2/+4
| | | | llvm-svn: 53716
* convert more operand loops to iterator formulationGabor Greif2008-05-291-21/+26
| | | | llvm-svn: 51663
* Use isSingleValueType instead of isFirstClassType toDan Gohman2008-05-231-3/+3
| | | | | | exclude struct and array types. llvm-svn: 51459
* API change for {BinaryOperator|CmpInst|CastInst}::create*() --> Create. ↵Gabor Greif2008-05-161-2/+2
| | | | | | Legacy interfaces will be in place for some time. (Merge from use-diet branch.) llvm-svn: 51200
* Fix a bunch of 80col violations that arose from the Create API change. Tweak ↵Gabor Greif2008-05-151-1/+2
| | | | | | makefile targets to find these better. llvm-svn: 51143
* Clean up the use of static and anonymous namespaces. This turned upDan Gohman2008-05-131-4/+6
| | | | | | | several things that were neither in an anonymous namespace nor static but not intended to be global. llvm-svn: 51017
* When SRoA'ing a global variable, make sure the new globals get the Chris Lattner2008-04-261-5/+32
| | | | | | | | | appropriate alignment. This fixes a miscompilation of 252.eon on x86-64 (rdar://5891920). Bill, please pull this into Tak. llvm-svn: 50308
* API changes for class Use size reduction, wave 1.Gabor Greif2008-04-061-18/+17
| | | | | | | | Specifically, introduction of XXX::Create methods for Users that have a potentially variable number of Uses. llvm-svn: 49277
* Don't include <map> in Pass.h, which doesn't need it. This requiresDan Gohman2008-03-211-0/+1
| | | | | | adding <map> to many files that actually do need it. llvm-svn: 48667
* Reimplement the parameter attributes support, phase #1. hilights:Chris Lattner2008-03-121-12/+5
| | | | | | | | | | | | | | | | | | | | | | | 1. There is now a "PAListPtr" class, which is a smart pointer around the underlying uniqued parameter attribute list object, and manages its refcount. It is now impossible to mess up the refcount. 2. PAListPtr is now the main interface to the underlying object, and the underlying object is now completely opaque. 3. Implementation details like SmallVector and FoldingSet are now no longer part of the interface. 4. You can create a PAListPtr with an arbitrary sequence of ParamAttrsWithIndex's, no need to make a SmallVector of a specific size (you can just use an array or scalar or vector if you wish). 5. All the client code that had to check for a null pointer before dereferencing the pointer is simplified to just access the PAListPtr directly. 6. The interfaces for adding attrs to a list and removing them is a bit simpler. Phase #2 will rename some stuff (e.g. PAListPtr) and do other less invasive changes. llvm-svn: 48289
* Split ParameterAttributes.h, putting the complicatedDale Johannesen2008-02-221-1/+1
| | | | | | | stuff into ParamAttrsList.h. Per feedback from ParamAttrs changes. llvm-svn: 47504
* Make Transforms to be 4.3 warnings-cleanAnton Korobeynikov2008-02-201-2/+4
| | | | llvm-svn: 47371
* Simplify caller updating using a CallSite, asDuncan Sands2008-02-181-22/+16
| | | | | | | | requested by Chris. While there, do the same for an existing function committed by someone called "lattner" :) llvm-svn: 47273
* Remove any 'nest' parameter attributes if the functionDuncan Sands2008-02-161-10/+52
| | | | | | is not passed as an argument to a trampoline intrinsic. llvm-svn: 47220
* Don't let globalopt hack on volatile loads or stores.Chris Lattner2008-01-291-1/+4
| | | | llvm-svn: 46523
* Fix the miscompilation of MiBench/consumer-lame that was exposed by Evan'sChris Lattner2008-01-141-59/+97
| | | | | | | byval work. This miscompilation is due to the program indexing an array out of range and us doing a transformation that broke this. llvm-svn: 45949
* The isNotSuitableForSRA property is now dead, don't compute it.Chris Lattner2008-01-141-45/+1
| | | | llvm-svn: 45948
* Change SRAGlobal to not depend on isNotSuitableForSRA, which makes it very Chris Lattner2008-01-141-2/+75
| | | | | | difficult to understand the invariants. llvm-svn: 45947
* Make the 'shrink global to bool' optimization more self contained, and thus Chris Lattner2008-01-141-10/+25
| | | | | | easier to show that its safe. No functionality change. llvm-svn: 45946
* Fix PR1896Chris Lattner2008-01-041-1/+1
| | | | llvm-svn: 45568
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | llvm-svn: 45418
* Change the PointerType api for creating pointer types. The old functionality ↵Christopher Lamb2007-12-171-2/+2
| | | | | | of PointerType::get() has become PointerType::getUnqual(), which returns a pointer in the generic address space. The new prototype of PointerType::get() requires both a type and an address space. llvm-svn: 45082
* Fix the regression on Transforms/GlobalOpt/deadglobal-2.ll from myChris Lattner2007-11-131-3/+3
| | | | | | patch on friday. llvm-svn: 44068
* Tighten up a check for folding away loads from (newly constant) globals. ThisChris Lattner2007-11-091-6/+11
| | | | | | | fixes a crash on Transforms/GlobalOpt/2007-11-09-GEP-GEP-Crash.ll and rdar://5585488. llvm-svn: 43949
* Executive summary: getTypeSize -> getTypeStoreSize / getABITypeSize.Duncan Sands2007-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 a logic error in ValueIsOnlyUsedLocallyOrStoredToOneGlobal that caused Chris Lattner2007-09-141-4/+4
| | | | | | | miscompilation of 188.ammp. Reject select and bitcast in ValueIsOnlyUsedLocallyOrStoredToOneGlobal because RewriteHeapSROALoadUser can't handle it. llvm-svn: 41950
* Teach GlobalLoadUsesSimpleEnoughForHeapSRA and the SROA rewriter how to handleChris Lattner2007-09-131-14/+62
| | | | | | | a limited form of PHI nodes. This finally fixes PR1639, speeding 179.art up from 7.84s to 3.13s on PPC. llvm-svn: 41933
* be tolerant of PHI nodes when rewriting heap SROA code. This is a stepChris Lattner2007-09-131-26/+50
| | | | | | along the way of PR1639 llvm-svn: 41930
* refactor some code, no functionality change. On the path to PR1639Chris Lattner2007-09-131-50/+56
| | | | llvm-svn: 41929
* Make ValueIsOnlyUsedLocallyOrStoredToOneGlobal smart enough to see throughChris Lattner2007-09-131-5/+16
| | | | | | bitcasts and phis. This is a step to fixing PR1639. llvm-svn: 41928
* Make AllUsesOfLoadedValueWillTrapIfNull strong enough to see through PHIChris Lattner2007-09-131-6/+15
| | | | | | nodes. This is the first step of the fix for PR1639. llvm-svn: 41927
OpenPOWER on IntegriCloud