summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils
Commit message (Collapse)AuthorAgeFilesLines
* Fix indentAnton Korobeynikov2007-11-091-12/+11
| | | | llvm-svn: 43941
* Forget to commit users part of value mapper interfaceAnton Korobeynikov2007-11-094-4/+4
| | | | llvm-svn: 43940
* And delete this oneAnton Korobeynikov2007-11-091-29/+0
| | | | llvm-svn: 43939
* Finishing initial docs for all transformations in Passes.html.Gordon Henriksen2007-11-042-4/+4
| | | | | | Also cleaned up some comments in source files. llvm-svn: 43674
* Add std:: to sort calls.Dan Gohman2007-11-021-1/+1
| | | | llvm-svn: 43652
* Change illegal uses of ++ to uses of STLExtra.h's next function.Dan Gohman2007-11-021-1/+2
| | | | llvm-svn: 43651
* 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 PR1752 and LoopSimplify/2007-10-28-InvokeCrash.ll: terminators Chris Lattner2007-10-291-4/+6
| | | | | | can have uses too. Wouldn't it be nice if invoke didn't exist? :) llvm-svn: 43426
* Reg2Mem cleanup and optimizations:Anton Korobeynikov2007-10-211-12/+26
| | | | | | | - enable phi instructions demotion to stack - create alloca instructions in the entry block llvm-svn: 43208
* Move Split<...>() into DomTreeBase. This should make the #include's of ↵Owen Anderson2007-10-182-2/+0
| | | | | | | | | | DominatorInternals.h in CodeExtractor and LoopSimplify unnecessary. Hartmut, could you confirm that this fixes the issues you were seeing? llvm-svn: 43115
* Fixed linker errors (unresolved externals: split<>(...)) when compiling with ↵Hartmut Kaiser2007-10-172-0/+2
| | | | | | VC++. Please review. llvm-svn: 43081
* Fix comment.Devang Patel2007-09-171-1/+1
| | | | llvm-svn: 42048
* Merge DenseMapKeyInfo & DenseMapValueInfo into DenseMapInfoChris Lattner2007-09-171-7/+11
| | | | | | | Add a new DenseMapInfo::isEqual method to allow clients to redefine the equality predicate used when probing the hash table. llvm-svn: 42042
* Insert cloned loop basic blocks before original loop header.Devang Patel2007-09-041-1/+3
| | | | llvm-svn: 41713
* Update GEP constructors to use an iterator interface to fixDavid Greene2007-09-042-16/+21
| | | | | | GLIBCXX_DEBUG issues. llvm-svn: 41697
* Silence warning while compiling with gcc 4.2Anton Korobeynikov2007-09-021-1/+2
| | | | llvm-svn: 41676
* Update InvokeInst to work like CallInstDavid Greene2007-08-271-1/+1
| | | | llvm-svn: 41506
* Don't promote volatile loads/stores. This is needed (for example) to handle ↵Anton Korobeynikov2007-08-261-3/+6
| | | | | | | | setjmp/longjmp properly. This fixes PR1520. llvm-svn: 41461
* Use SmallVector instead of std::vector.Devang Patel2007-08-212-8/+6
| | | | llvm-svn: 41207
* When one branch of condition is eliminated then head of the otherDevang Patel2007-08-171-1/+2
| | | | | | branch is not necessary immediate dominators of merge blcok in all cases. llvm-svn: 41144
* Break infinite loop.Devang Patel2007-08-141-15/+17
| | | | llvm-svn: 41091
* If NewBB dominates DestBB then DestBB is not part of NewBB's dominance frontier.Devang Patel2007-08-131-1/+5
| | | | llvm-svn: 41051
* Add utility to clone loops.Devang Patel2007-08-101-0/+149
| | | | llvm-svn: 40997
* remove some dead linesChris Lattner2007-08-061-2/+0
| | | | llvm-svn: 40859
* rewrite the code used to construct pruned SSA form with the IDF method.Chris Lattner2007-08-041-82/+114
| | | | | | | | | | | | | | | | In the old way, we computed and inserted phi nodes for the whole IDF of the definitions of the alloca, then computed which ones were dead and removed them. In the new method, we first compute the region where the value is live, and use that information to only insert phi nodes that are live. This eliminates the need to compute liveness later, and stops the algorithm from inserting a bunch of phis which it then later removes. This speeds up the testcase in PR1432 from 2.00s to 0.15s (14x) in a release build and 6.84s->0.50s (14x) in a debug build. llvm-svn: 40825
* Factor out a whole bunch of code into it's own method.Chris Lattner2007-08-041-65/+82
| | | | llvm-svn: 40824
* Use getNumPreds(BB) instead of computing them manually. This is a very small butChris Lattner2007-08-041-4/+4
| | | | | | measurable speedup. llvm-svn: 40823
* Change the rename pass to be "tail recursive", only adding N-1 successorsChris Lattner2007-08-041-21/+35
| | | | | | | to the worklist, and handling the last one with a 'tail call'. This speeds up PR1432 from 2.0578s to 2.0012s (2.8%) llvm-svn: 40822
* cache computation of #preds for a BB. This speeds upChris Lattner2007-08-041-3/+14
| | | | | | mem2reg from 2.0742->2.0522s on PR1432. llvm-svn: 40821
* reserve operand space for phi nodes when we insert them.Chris Lattner2007-08-041-0/+1
| | | | llvm-svn: 40820
* use continue to avoid nesting, no functionality change.Chris Lattner2007-08-041-14/+15
| | | | llvm-svn: 40819
* Promoting allocas with the 'single store' fastpath is Chris Lattner2007-08-041-10/+9
| | | | | | | faster than with the 'local to a block' fastpath. This speeds up PR1432 from 2.1232 to 2.0686s (2.6%) llvm-svn: 40818
* When PromoteLocallyUsedAllocas promoted allocas, it didn't rememberChris Lattner2007-08-041-2/+13
| | | | | | | to increment NumLocalPromoted, and didn't actually delete the dead alloca, leading to an extra iteration of mem2reg. llvm-svn: 40817
* std::map -> DenseMapChris Lattner2007-08-041-3/+3
| | | | llvm-svn: 40816
* fix a logic bug where we wouldn't promote single store allocas if the Chris Lattner2007-08-041-2/+2
| | | | | | | | | stored value was a non-instruction value. Doh. This increase the # single store allocas from 8982 to 9026, and speeds up mem2reg on the testcase in PR1432 from 2.17 to 2.13s. llvm-svn: 40813
* When we do the single-store optimization, delete both the storeChris Lattner2007-08-041-2/+8
| | | | | | | | and the alloca so they don't get reprocessed. This speeds up PR1432 from 2.20s to 2.17s. llvm-svn: 40812
* Three improvements:Chris Lattner2007-08-041-6/+16
| | | | | | | | | | | | | 1. Check for revisiting a block before checking domination, which is faster. 2. If the stored value isn't an instruction, we don't have to check for domination. 3. If we have a value used in the same block more than once, make sure to remove the block from the UsingBlocks vector. Not doing so forces us to go through the slow path for the alloca. The combination of these improvements increases the number of allocas on the fastpath from 8935 to 8982 on PR1432. This speeds it up from 2.90s to 2.20s (31%) llvm-svn: 40811
* switch from using a std::set to using a SmallPtrSet. This speeds up theChris Lattner2007-08-041-3/+3
| | | | | | testcase in PR1432 from 6.33s to 2.90s (2.22x) llvm-svn: 40810
* In mem2reg, when handling the single-store case, make sure to removeChris Lattner2007-08-041-8/+10
| | | | | | | | | | a using block from the list if we handle it. Not doing this caused us to not be able to promote (with the fast path) allocas which have uses (whoops). This increases the # allocas hitting this fastpath from 4042 to 8935 on the testcase in PR1432, speeding up mem2reg by 2.6x llvm-svn: 40809
* split rewriting of single-store allocas into its ownChris Lattner2007-08-041-39/+57
| | | | | | method. llvm-svn: 40806
* refactor some code to shrink PromoteMem2Reg::run a bitChris Lattner2007-08-041-63/+96
| | | | llvm-svn: 40805
* add a typedef, no other change.Chris Lattner2007-08-041-7/+8
| | | | llvm-svn: 40804
* avoid an unneeded vector copy. This speeds up mem2reg on the testcase Chris Lattner2007-08-041-1/+9
| | | | | | in PR1432 by 6% llvm-svn: 40803
* make RenamePassWorkList a local var instead of an ivar.Chris Lattner2007-08-041-8/+8
| | | | llvm-svn: 40802
* More explicit keywords.Dan Gohman2007-08-013-4/+4
| | | | llvm-svn: 40673
* New CallInst interface to address GLIBCXX_DEBUG errors caused byDavid Greene2007-08-013-6/+6
| | | | | | | | indexing an empty std::vector. Updates to all clients. llvm-svn: 40660
* LCSSA preserves dom info.Devang Patel2007-07-301-0/+8
| | | | llvm-svn: 40604
* Use SmallPtrSet.Devang Patel2007-07-272-3/+2
| | | | llvm-svn: 40560
* Move the GET_SIDE_EFFECT_INFO logic from isInstructionTriviallyDeadDan Gohman2007-07-261-7/+0
| | | | | | | to Instruction::mayWriteToMemory, fixing a FIXME, and helping various places that call mayWriteToMemory directly. llvm-svn: 40533
* Add BasicInliner interface. Devang Patel2007-07-252-0/+412
| | | | | | | This interface allows clients to inline bunch of functions with module level call graph information.:wq llvm-svn: 40486
OpenPOWER on IntegriCloud