summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/GlobalOpt.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* performance: get rid of repeated dereferencing of use_iterator by caching ↵Gabor Greif2010-04-061-21/+28
| | | | | | its result llvm-svn: 100547
* const-ize predicate ValueIsOnlyUsedLocallyOrStoredToOneGlobalGabor Greif2010-04-061-9/+10
| | | | llvm-svn: 100546
* use CallSite to access calls vs. invokes uniformlyGabor Greif2010-04-061-5/+6
| | | | | | and remove assumptions about operand order llvm-svn: 100544
* Revert the recent alignment changes. They're broken for -Os because,Dan Gohman2010-04-021-7/+1
| | | | | | | in particular, they end up aligning strings at 16-byte boundaries, and there's no way for GlobalOpt to check OptForSize. llvm-svn: 100172
* Make globalopt refine global variable alignment.Dan Gohman2010-04-021-1/+7
| | | | llvm-svn: 100160
* Introduce ImmutableCallSite, useful for contexts where no mutationGabor Greif2010-04-011-37/+37
| | | | | | | | | is necessary. Inherits from new templated baseclass CallSiteBase<> which is highly customizable. Base CallSite on it too, in a configuration that allows full mutation. Adapt some call sites in analyses to employ ImmutableCallSite. llvm-svn: 100100
* Add a setCalledFunction member to InvokeInst (like in CallInst)Gabor Greif2010-03-201-2/+2
| | | | | | | and use this (as well as getCalledValue) to access the callee, instead of {g|s}etOperand(0). llvm-svn: 99084
* Fix rdar://7694996 a miscompile of 183.equake from my patch yesterday,Chris Lattner2010-02-261-3/+2
| | | | | | | | | | | | | confusing the old MAT variable with the new GlobalType one. This caused us to promote the @disp global pointer into: @disp.body = internal global double*** undef instead of: @disp.body = internal global [3 x double**] undef llvm-svn: 97285
* remove dead code, by this point all uses of CI are gone.Chris Lattner2010-02-261-4/+1
| | | | llvm-svn: 97283
* fix PR6435 another bug from the MallocInst elimination work.Chris Lattner2010-02-261-3/+1
| | | | llvm-svn: 97231
* rewrite OptimizeGlobalAddressOfMalloc to fix PR6422, some bugsChris Lattner2010-02-251-79/+73
| | | | | | introduced when mallocinst was eliminated. llvm-svn: 97178
* Modernize comment.Nick Lewycky2010-02-251-1/+1
| | | | llvm-svn: 97121
* There are two ways of checking for a given type, for example isa<PointerType>(T)Duncan Sands2010-02-161-5/+5
| | | | | | | and T->isPointerTy(). Convert most instances of the first form to the second form. Requested by Chris. llvm-svn: 96344
* Uniformize the names of type predicates: rather than having isFloatTy andDuncan Sands2010-02-151-2/+2
| | | | | | isInteger, we now have isFloatTy and isIntegerTy. Requested by Chris! llvm-svn: 96223
* Keep iterating over all uses when meeting a phi node in ↵Jakob Stoklund Olesen2010-01-291-2/+2
| | | | | | | | | | | AllUsesOfValueWillTrapIfNull(). This bug was exposed by my inliner cost changes in r94615, and caused failures of lencod on most architectures when building with LTO. This patch fixes lencod and 464.h264ref on x86-64 (and likely others). llvm-svn: 94858
* handle ConstantVector while I'm in here.Chris Lattner2010-01-071-0/+3
| | | | llvm-svn: 92892
* fix a globalopt crash on 'bullet' (handling evaluation of a storeChris Lattner2010-01-071-16/+20
| | | | | | | | | | to an element of a vector in a static ctor) which occurs with an unrelated patch I'm testing. Annoyingly, EvaluateStoreInto basically does exactly the same stuff as InsertElement constant folding, but it now handles vectors, and you can't insertelement into a vector. It would be 'really nice' if GEP into a vector were not legal. llvm-svn: 92889
* Move remaining stuff to the isInteger predicate.Benjamin Kramer2010-01-051-1/+1
| | | | llvm-svn: 92771
* Avoid going through the LLVMContext for type equality where it's safe to ↵Benjamin Kramer2010-01-051-1/+1
| | | | | | dereference the type pointer. llvm-svn: 92726
* Change errs() to dbgs().David Greene2010-01-051-25/+25
| | | | llvm-svn: 92629
* Teach GlobalOpt to delete aliases with internal linkage (afterDuncan Sands2009-12-081-21/+20
| | | | | | | forwarding any uses). GlobalDCE can also do this, but is only run at -O3. llvm-svn: 90850
* Make ConstantFoldConstantExpression recursively visit the entireDan Gohman2009-11-231-0/+9
| | | | | | | | | | ConstantExpr, not just the top-level operator. This allows it to fold many more constants. Also, make GlobalOpt call ConstantFoldConstantExpression on GlobalVariable initializers. llvm-svn: 89659
* Update computeArraySize() to use ComputeMultiple() to determine the array ↵Victor Hernandez2009-11-101-7/+7
| | | | | | size associated with a malloc; also extend PerformHeapAllocSRoA() to check if the optimized malloc's arg had its highest bit set, so that it is safe for ComputeMultiple() to look through sext instructions while determining the optimized malloc's array size llvm-svn: 86676
* - new SROA mallocs should have the mallocs running-or'ed, not the malloc's ↵Victor Hernandez2009-11-071-19/+22
| | | | | | | | bitcast - fix ProcessInternalGlobal() debug output llvm-svn: 86317
* Re-commit r86077 now that r86290 fixes the 179.art and 175.vpr ARM regressions.Victor Hernandez2009-11-071-69/+72
| | | | | | | | | | | | | | | | | | | | | | | Here is the original commit message: This commit updates malloc optimizations to operate on malloc calls that have constant int size arguments. Update CreateMalloc so that its callers specify the size to allocate: MallocInst-autoupgrade users use non-TargetData-computed allocation sizes. Optimization uses use TargetData to compute the allocation size. Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays. Extend getMallocType() to support malloc calls that have non-bitcast uses. Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses. The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly. Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses. The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use. Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use. Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes. llvm-svn: 86311
* remove a bunch of extraneous LLVMContext argumentsChris Lattner2009-11-061-120/+95
| | | | | | from various APIs, addressing PR5325. llvm-svn: 86231
* Revert r86077 because it caused crashes in 179.art and 175.vpr on ARMVictor Hernandez2009-11-061-74/+68
| | | | llvm-svn: 86213
* Update CreateMalloc so that its callers specify the size to allocate:Victor Hernandez2009-11-051-68/+74
| | | | | | | | | | | | | | | | | | MallocInst-autoupgrade users use non-TargetData-computed allocation sizes. Optimization uses use TargetData to compute the allocation size. Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays. Extend getMallocType() to support malloc calls that have non-bitcast uses. Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses. The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly. Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses. The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use. Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use. Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes. llvm-svn: 86077
* cleanups, switch GlobalDCE to SmallPtrSet instead of std::setChris Lattner2009-11-011-3/+2
| | | | llvm-svn: 85730
* Revert 85678/85680. The decision is to stay with the current form of Chris Lattner2009-11-011-1/+2
| | | | | | | indirectbr, thus we don't need "blockaddr(@func, null)". Eliminate it for simplicity. llvm-svn: 85699
* adjust a couple xforms to work with null bb's in BlockAddress.Chris Lattner2009-10-311-2/+1
| | | | llvm-svn: 85680
* just for the hell of it, allow globalopt to statically evaluate Chris Lattner2009-10-291-0/+6
| | | | | | static constructors with indirect gotos :) llvm-svn: 85495
* Extend getMallocArraySize() to determine the array size if the malloc ↵Victor Hernandez2009-10-281-11/+9
| | | | | | | | | | | | | | argument is: ArraySize * ElementSize ElementSize * ArraySize ArraySize << log2(ElementSize) ElementSize << log2(ArraySize) Refactor isArrayMallocHelper and delete isSafeToGetMallocArraySize, so that there is only 1 copy of the malloc array determining logic. Update users of getMallocArraySize() to not bother calling isArrayMalloc() as well. llvm-svn: 85421
* Rename MallocFreeHelper as MemoryBuiltinsVictor Hernandez2009-10-271-1/+1
| | | | llvm-svn: 85286
* Rename MallocHelper as MallocFreeHelper, since it now also identifies calls ↵Victor Hernandez2009-10-261-1/+1
| | | | | | to free() llvm-svn: 85181
* Remove includes of Support/Compiler.h that are no longer needed after theNick Lewycky2009-10-251-1/+0
| | | | | | VISIBILITY_HIDDEN removal. llvm-svn: 85043
* Remove VISIBILITY_HIDDEN from class/struct found inside anonymous namespaces.Nick Lewycky2009-10-251-2/+2
| | | | | | | Chris claims we should never have visibility_hidden inside any .cpp file but that's still not true even after this commit. llvm-svn: 85042
* Auto-upgrade free instructions to calls to the builtin free function.Victor Hernandez2009-10-241-2/+3
| | | | | | | Update all analysis passes and transforms to treat free calls just like FreeInst. Remove RaiseAllocations and all its tests since FreeInst no longer needs to be raised. llvm-svn: 84987
* Remove MallocInst from LLVM Instructions.Victor Hernandez2009-10-171-395/+0
| | | | llvm-svn: 84299
* HeapAllocSRoA also needs to check if malloc array size can be computed.Victor Hernandez2009-10-161-36/+40
| | | | llvm-svn: 84288
* Fix bug where array malloc with unexpected computation of the size argument ↵Victor Hernandez2009-10-151-17/+17
| | | | | | | | | | | | | | | | | | | | resulted in MallocHelper identifying the malloc as a non-array malloc. This broke GlobalOpt's optimization of stores of mallocs to global variables. The fix is to classify malloc's into 3 categories: 1. non-array mallocs 2. array mallocs whose array size can be determined 3. mallocs that cannot be determined to be of type 1 or 2 and cannot be optimized getMallocArraySize() returns NULL for category 3, and all users of this function must avoid their malloc optimization if this function returns NULL. Eventually, currently unexpected codegen for computing the malloc's size argument will be supported in isArrayMalloc() and getMallocArraySize(), extending malloc optimizations to those examples. llvm-svn: 84199
* Remove an unnnecessary LLVMContext argument inDan Gohman2009-10-051-6/+4
| | | | | | ConstantFoldLoadThroughGEPConstantExpr. llvm-svn: 83311
* Remove the default value for ConstantStruct::get's isPacked parameter andNick Lewycky2009-09-191-3/+3
| | | | | | update the code which was broken by this. llvm-svn: 82327
* Enhance transform passes so that they apply the same tranforms to malloc ↵Victor Hernandez2009-09-181-2/+423
| | | | | | | | calls as to MallocInst. Reviewed by Dan Gohman. llvm-svn: 82300
* Factor out the code for checking that all indices in a getelementptr areDan Gohman2009-09-101-15/+4
| | | | | | | | | within the notional bounds of the static type of the getelementptr (which is not the same as "inbounds") from GlobalOpt into a utility routine, and use it in ConstantFold.cpp to check whether there are any mis-behaved indices. llvm-svn: 81478
* Don't commit stores with addresses that have indices that are notDan Gohman2009-09-071-0/+21
| | | | | | | | compile-time constant integers or that are out of bounds for their corresponding static array types. These can cause aliasing that GlobalOpt assumes won't happen. llvm-svn: 81165
* Don't commit addresses of aggregate values. This avoids problems withDan Gohman2009-09-071-0/+5
| | | | | | | an aggregate store overlapping a different aggregate store, despite the stores having distinct addresses. llvm-svn: 81164
* Fix GlobalOpt to avoid committing a store if the address getelementptrDan Gohman2009-09-071-1/+2
| | | | | | | | is missing the inbounds flag. This is slightly conservative, but it avoids problems with two constants pointing to the same address but getting distinct entries in the Memory DenseMap. llvm-svn: 81163
* Preserve the InBounds flag when evaluating a getelementptr instructionDan Gohman2009-09-071-2/+3
| | | | | | into a getelementptr ConstantExpr. llvm-svn: 81162
* Simplify this code by using hasDefinitiveInitializer().Dan Gohman2009-09-071-9/+10
| | | | llvm-svn: 81161
OpenPOWER on IntegriCloud