summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
Commit message (Collapse)AuthorAgeFilesLines
* use getArgOperand instead of getOperandGabor Greif2010-06-301-4/+4
| | | | llvm-svn: 107271
* employ CallInst::ArgOffset (for now)Gabor Greif2010-06-281-2/+2
| | | | llvm-svn: 107015
* use cached valueGabor Greif2010-06-281-1/+1
| | | | llvm-svn: 107000
* minor cleanup to SROA: when lowering type unsafe accesses toChris Lattner2010-06-271-1/+6
| | | | | | | | large integers, the first inserted value would always create an 'or X, 0'. Even though this is trivially zapped by instcombine, don't bother creating this pointless instruction. llvm-svn: 106979
* Use pre-increment instead of post-increment when the result is not used.Dan Gohman2010-06-221-1/+1
| | | | llvm-svn: 106542
* use abstract accessors to CallInstGabor Greif2010-04-201-1/+1
| | | | llvm-svn: 101899
* Revert 101465, it broke internal OpenGL testing.Eric Christopher2010-04-161-8/+8
| | | | | | | Probably the best way to know that all getOperand() calls have been handled is to replace that API instead of updating. llvm-svn: 101579
* reapply r101434Gabor Greif2010-04-161-8/+8
| | | | | | | | | | | | | with a fix for self-hosting rotate CallInst operands, i.e. move callee to the back of the operand array the motivation for this patch are laid out in my mail to llvm-commits: more efficient access to operands and callee, faster callgraph-construction, smaller compiler binary llvm-svn: 101465
* fix comment noticed by BobChris Lattner2010-04-161-1/+1
| | | | llvm-svn: 101437
* back out r101423 and r101397, they break llvm-gcc self-host on darwin10Gabor Greif2010-04-161-8/+8
| | | | llvm-svn: 101434
* fix PR6832: we were using the alignment of a pointer when we Chris Lattner2010-04-161-6/+4
| | | | | | wanted the alignment of the pointee. llvm-svn: 101432
* improve comments.Chris Lattner2010-04-161-47/+70
| | | | llvm-svn: 101429
* pull all the ConvertToScalarInfo code together into oneChris Lattner2010-04-161-562/+568
| | | | | | place. llvm-svn: 101427
* more refactoring: suck some stuff out of SRoA into Chris Lattner2010-04-161-88/+96
| | | | | | ConvertToScalarInfo. llvm-svn: 101425
* introduce a new ConvertToScalarInfo struct to simplify Chris Lattner2010-04-151-62/+83
| | | | | | | CanConvertToScalar/MergeInType. Eliminate a pointless LLVMContext argument to MergeInType. llvm-svn: 101422
* tidy interface to isOnlyCopiedFromConstantGlobalChris Lattner2010-04-151-15/+14
| | | | llvm-svn: 101405
* reapply r101364, which has been backed out in r101368Gabor Greif2010-04-151-10/+10
| | | | | | | | | | | | | with a fix rotate CallInst operands, i.e. move callee to the back of the operand array the motivation for this patch are laid out in my mail to llvm-commits: more efficient access to operands and callee, faster callgraph-construction, smaller compiler binary llvm-svn: 101397
* back out r101364, as it trips the linux nightlybot on some clang C++ testsGabor Greif2010-04-151-10/+10
| | | | llvm-svn: 101368
* rotate CallInst operands, i.e. move callee to the backGabor Greif2010-04-151-10/+10
| | | | | | | | | | of the operand array the motivation for this patch are laid out in my mail to llvm-commits: more efficient access to operands and callee, faster callgraph-construction, smaller compiler binary llvm-svn: 101364
* performance: get rid of repeated dereferencing of use_iterator by caching ↵Gabor Greif2010-04-061-5/+7
| | | | | | its result llvm-svn: 100550
* Reapply address space patch after fixing an issue in MemCopyOptimizer.Mon P Wang2010-04-041-6/+26
| | | | | | | Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset, e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) llvm-svn: 100304
* Revert r100191 since it breaks objc in clang Mon P Wang2010-04-021-26/+6
| | | | llvm-svn: 100199
* Reapply address space patch after fixing an issue in MemCopyOptimizer.Mon P Wang2010-04-021-6/+26
| | | | | | | Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset, e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) llvm-svn: 100191
* Revert Mon Ping's change 99928, since it broke all the llvm-gcc buildbots.Bob Wilson2010-03-301-26/+6
| | | | llvm-svn: 99948
* Added support for address spaces and added a isVolatile field to memcpy, ↵Mon P Wang2010-03-301-6/+26
| | | | | | | | | memmove, and memset, e.g., llvm.memcpy.i32(i8*, i8*, i32, i32) -> llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) A update of langref will occur in a subsequent checkin. llvm-svn: 99928
* There are two ways of checking for a given type, for example isa<PointerType>(T)Duncan Sands2010-02-161-18/+18
| | | | | | | 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-6/+7
| | | | | | isInteger, we now have isFloatTy and isIntegerTy. Requested by Chris! llvm-svn: 96223
* Adjust the heuristics used to decide when SROA is likely to be profitable.Bob Wilson2010-02-031-18/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SRThreshold value makes perfect sense for checking if an entire aggregate should be promoted to a scalar integer, but it is not so good for splitting an aggregate into its separate elements. A struct may contain a large embedded array along with some scalar fields that would benefit from being split apart by SROA. Even if the total aggregate size is large, it may still be good to perform SROA. Thus, the most important piece of this patch is simply moving the aggregate size comparison vs. SRThreshold so that it guards only the aggregate promotion. We have also been checking the number of elements to decide if an aggregate should be split up. The limit of "SRThreshold/4" seemed rather arbitrary, and I don't think it's very useful to derive this limit from SRThreshold anyway. I've collected some data showing that the current default limit of 32 (since SRThreshold defaults to 128) is a reasonable cutoff for struct types. One thing suggested by the data is that distinguishing between structs and arrays might be useful. There are (obviously) a lot more large arrays than large structs (as measured by the number of elements and not the total size -- a large array inside a struct still counts as a single element given the way we do SROA right now). Out of 8377 arrays where we successfully performed SROA while compiling a large set of benchmarks, only 16 of them had more than 8 elements. And, for those 16 arrays, it's not at all clear that SROA was actually beneficial. So, to offset the compile time cost of investigating more large structs for SROA, the patch lowers the limit on array elements to 8. This fixes Apple Radar 7563690. llvm-svn: 95224
* Use the less expensive getName function instead of getNameStr.Benjamin Kramer2010-01-271-5/+4
| | | | llvm-svn: 94683
* Change Value::getUnderlyingObject to have the MaxLookup value specified as aBob Wilson2010-01-251-3/+3
| | | | | | | | | | | | parameter with a default value, instead of just hardcoding it in the implementation. The limit of MaxLookup = 6 was introduced in r69151 to fix a performance problem with O(n^2) behavior in instcombine, but the scalarrepl pass is relying on getUnderlyingObject to go all the way back to an AllocaInst. Making the limit part of the method signature makes it clear that by default the result is limited and should help avoid similar problems in the future. This fixes pr6126. llvm-svn: 94433
* DbgInfoIntrinsics no longer appear in an instruction's use list; so clean up ↵Victor Hernandez2010-01-211-59/+7
| | | | | | looking for them in use iterations and remove OnlyUsedByDbgInfoIntrinsics() llvm-svn: 94111
* Fix a crash in scalarrepl for memcpy/memmove where the source and destinationBob Wilson2010-01-191-6/+10
| | | | | | | | | are the same. I had already fixed a similar problem where the source and destination were different bitcasts derived from the same alloca, but the previous fix still did not handle the case where both operands are exactly the same value. Radar 7552893. llvm-svn: 93848
* Use do+while instead of while for loops which obviously have aDan Gohman2010-01-051-1/+1
| | | | | | non-zero trip count. Use SmallVector's pop_back_val(). llvm-svn: 92734
* Change errs() to dbgs().David Greene2010-01-051-8/+8
| | | | llvm-svn: 92610
* Fix the Convert to scalar to not insert dead loads in the store case. TheChris Lattner2009-12-221-2/+12
| | | | | | | | | | | | | | load is needed when we have a small store into a large alloca (at which point we get a load/insert/store sequence), but when you do a full-sized store, this load ends up being dead. This dead load is bad in really large nasty testcases where the load ends up causing mem2reg to insert large chains of dependent phi nodes which only ADCE can delete. Instead of doing this, just don't insert the dead load. This fixes rdar://6864035 llvm-svn: 91917
* fix some fixme's by using twinesChris Lattner2009-12-221-6/+2
| | | | llvm-svn: 91916
* Generalize SROA to allow the first index of a GEP to be non-zero. Add aBob Wilson2009-12-221-23/+4
| | | | | | | | missing check that an array reference doesn't go past the end of the array, and remove some redundant checks for in-bound array and vector references that are no longer needed. llvm-svn: 91897
* Remove special-case SROA optimization of variable indexes to one-element andBob Wilson2009-12-211-141/+30
| | | | | | | | two-element arrays. After restructuring the SROA code, it was not safe to do this without adding more checking. It is not clear that this special-case has really been useful, and removing this simplifies the code quite a bit. llvm-svn: 91828
* Update my SROA changes in response to review.Bob Wilson2009-12-191-33/+38
| | | | | | | | | | * change FindElementAndOffset to return a uint64_t instead of unsigned, and to identify the type to be used for that result in a GEP instruction. * move "isa<ConstantInt>" to be first in conditional. * replace some dyn_casts with casts. * add a comment about handling mem intrinsics. llvm-svn: 91762
* Reapply 91459 with a simple fix for the problem that broke the x86_64-darwinBob Wilson2009-12-181-405/+425
| | | | | | | bootstrap. This also replaces the WeakVH references that Chris objected to with normal Value references. llvm-svn: 91711
* Re-revert 91459. It's breaking the x86_64 darwin bootstrap.Bob Wilson2009-12-171-424/+404
| | | | llvm-svn: 91607
* Reapply r91459, it was only unmasking the bug, and since TOT is still broken ↵Daniel Dunbar2009-12-161-404/+424
| | | | | | having it reverted does no good. llvm-svn: 91559
* Revert "Reapply 91184 with fixes and an addition to the testcase to cover theDaniel Dunbar2009-12-161-424/+404
| | | | | | | | | problem", this broke llvm-gcc bootstrap for release builds on x86_64-apple-darwin10. This reverts commit db22309800b224a9f5f51baf76071d7a93ce59c9. llvm-svn: 91534
* Reapply 91184 with fixes and an addition to the testcase to cover the problemBob Wilson2009-12-151-404/+424
| | | | | | | | | | found last time. Instead of trying to modify the IR while iterating over it, I've change it to keep a list of WeakVH references to dead instructions, and then delete those instructions later. I also added some special case code to detect and handle the situation when both operands of a memcpy intrinsic are referencing the same alloca. llvm-svn: 91459
* revert r91184, because it causes a crash on a .bc file I justChris Lattner2009-12-141-366/+390
| | | | | | sent to Bob. llvm-svn: 91268
* Revise scalar replacement to be more flexible about handle bitcasts and GEPs.Bob Wilson2009-12-111-390/+366
| | | | | | | | | | | | | | | While scanning through the uses of an alloca, keep track of the current offset relative to the start of the alloca, and check memory references to see if the offset & size correspond to a component within the alloca. This has the nice benefit of unifying much of the code from isSafeUseOfAllocation, isSafeElementUse, and isSafeUseOfBitCastedAllocation. The code to rewrite the uses of a promoted alloca, after it is determined to be safe, is reorganized in the same way. Also, when rewriting GEP instructions, mark them as "in-bounds" since all the indices are known to be safe. llvm-svn: 91184
* Fix a comment.Bob Wilson2009-12-091-1/+1
| | | | llvm-svn: 90975
* Some superficial cleanups.Bob Wilson2009-12-081-4/+3
| | | | llvm-svn: 90866
* Clean up dead operands left around after SROA replaces a mem intrinsic.Bob Wilson2009-12-081-0/+6
| | | | | | | I'm not aware that this does anything significant on its own, but it's needed for another patch that I'm working on. llvm-svn: 90864
* Fix up some comments.Bob Wilson2009-12-041-12/+5
| | | | llvm-svn: 90603
OpenPOWER on IntegriCloud