summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Get rid of static constructors for pass registration. Instead, every pass ↵Owen Anderson2010-10-191-0/+1
| | | | | | | | | | | | | | | | | exposes an initializeMyPassFunction(), which must be called in the pass's constructor. This function uses static dependency declarations to recursively initialize the pass's dependencies. Clients that only create passes through the createFooPass() APIs will require no changes. Clients that want to use the CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h before parsing commandline arguments. I have tested this with all standard configurations of clang and llvm-gcc on Darwin. It is possible that there are problems with the static dependencies that will only be visible with non-standard options. If you encounter any crash in pass registration/creation, please send the testcase to me directly. llvm-svn: 116820
* Eliminate some calls to Value::getNameStr.Benjamin Kramer2010-10-161-1/+1
| | | | llvm-svn: 116670
* Begin adding static dependence information to passes, which will allow us toOwen Anderson2010-10-121-1/+5
| | | | | | | | | perform initialization without static constructors AND without explicit initialization by the client. For the moment, passes are required to initialize both their (potential) dependencies and any passes they preserve. I hope to be able to relax the latter requirement in the future. llvm-svn: 116334
* Now with fewer extraneous semicolons!Owen Anderson2010-10-071-1/+1
| | | | llvm-svn: 115996
* Massive rewrite of MMX: Dale Johannesen2010-09-301-0/+6
| | | | | | | | | | | | | | | | | | | The x86_mmx type is used for MMX intrinsics, parameters and return values where these use MMX registers, and is also supported in load, store, and bitcast. Only the above operations generate MMX instructions, and optimizations do not operate on or produce MMX intrinsics. MMX-sized vectors <2 x i32> etc. are lowered to XMM or split into smaller pieces. Optimizations may occur on these forms and the result casted back to x86_mmx, provided the result feeds into a previous existing x86_mmx operation. The point of all this is prevent optimizations from introducing MMX operations, which is unsafe due to the EMMS problem. llvm-svn: 115243
* deepen my MMX/SRoA hack to avoid hurting non-x86 codegen.Chris Lattner2010-09-011-2/+8
| | | | llvm-svn: 112763
* add a gross hack to work around a problem that Argiris reportedChris Lattner2010-09-011-6/+25
| | | | | | | | | | | | | on llvmdev: SRoA is introducing MMX datatypes like <1 x i64>, which then cause random problems because the X86 backend is producing mmx stuff without inserting proper emms calls. In the short term, force off MMX datatypes. In the long term, the X86 backend should not select generic vector types to MMX registers. This is being worked on, but won't be done in time for 2.8. rdar://8380055 llvm-svn: 112696
* remove dead prototype.Chris Lattner2010-08-181-2/+1
| | | | llvm-svn: 111342
* Reapply r110396, with fixes to appease the Linux buildbot gods.Owen Anderson2010-08-061-1/+1
| | | | llvm-svn: 110460
* Revert r110396 to fix buildbots.Owen Anderson2010-08-061-1/+1
| | | | llvm-svn: 110410
* Don't use PassInfo* as a type identifier for passes. Instead, use the ↵Owen Anderson2010-08-051-1/+1
| | | | | | | | address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. llvm-svn: 110396
* Fix batch of converting RegisterPass<> to INTIALIZE_PASS().Owen Anderson2010-07-211-1/+2
| | | | llvm-svn: 109045
* eliminate CallInst::ArgOffsetGabor Greif2010-07-161-2/+2
| | | | llvm-svn: 108522
* Fix the second half of PR7437: scalarrepl wasn't preservingChris Lattner2010-07-081-21/+9
| | | | | | address spaces when SRoA'ing memcpy's. llvm-svn: 107846
* 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
OpenPOWER on IntegriCloud