summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
Commit message (Collapse)AuthorAge
* API changes for class Use size reduction, wave 1.Gabor Greif2008-04-06
| | | | | | | | | Specifically, introduction of XXX::Create methods for Users that have a potentially variable number of Uses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49277 91177308-0d34-0410-b5e6-96231b3b80d8
* Update -mem2reg to use succ_iterator instead of iterating across TerminatorInstNick Lewycky2008-03-13
| | | | | | | successors. This makes it support nounwind. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48320 91177308-0d34-0410-b5e6-96231b3b80d8
* Make RenamePass faster by making the 'is this a new phi node'Chris Lattner2008-02-05
| | | | | | | | | check more intelligent. This speeds up mem2reg from 5.29s to 0.79s on a synthetic testcase with tons of predecessors and phi nodes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46767 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
* Finishing initial docs for all transformations in Passes.html.Gordon Henriksen2007-11-04
| | | | | | Also cleaned up some comments in source files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43674 91177308-0d34-0410-b5e6-96231b3b80d8
* Merge DenseMapKeyInfo & DenseMapValueInfo into DenseMapInfoChris Lattner2007-09-17
| | | | | | | | Add a new DenseMapInfo::isEqual method to allow clients to redefine the equality predicate used when probing the hash table. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42042 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't promote volatile loads/stores. This is needed (for example) to handle ↵Anton Korobeynikov2007-08-26
| | | | | | | | | setjmp/longjmp properly. This fixes PR1520. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41461 91177308-0d34-0410-b5e6-96231b3b80d8
* rewrite the code used to construct pruned SSA form with the IDF method.Chris Lattner2007-08-04
| | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40825 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor out a whole bunch of code into it's own method.Chris Lattner2007-08-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40824 91177308-0d34-0410-b5e6-96231b3b80d8
* Use getNumPreds(BB) instead of computing them manually. This is a very small butChris Lattner2007-08-04
| | | | | | | measurable speedup. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40823 91177308-0d34-0410-b5e6-96231b3b80d8
* Change the rename pass to be "tail recursive", only adding N-1 successorsChris Lattner2007-08-04
| | | | | | | | to the worklist, and handling the last one with a 'tail call'. This speeds up PR1432 from 2.0578s to 2.0012s (2.8%) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40822 91177308-0d34-0410-b5e6-96231b3b80d8
* cache computation of #preds for a BB. This speeds upChris Lattner2007-08-04
| | | | | | | mem2reg from 2.0742->2.0522s on PR1432. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40821 91177308-0d34-0410-b5e6-96231b3b80d8
* reserve operand space for phi nodes when we insert them.Chris Lattner2007-08-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40820 91177308-0d34-0410-b5e6-96231b3b80d8
* use continue to avoid nesting, no functionality change.Chris Lattner2007-08-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40819 91177308-0d34-0410-b5e6-96231b3b80d8
* Promoting allocas with the 'single store' fastpath is Chris Lattner2007-08-04
| | | | | | | | | faster than with the 'local to a block' fastpath. This speeds up PR1432 from 2.1232 to 2.0686s (2.6%) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40818 91177308-0d34-0410-b5e6-96231b3b80d8
* When PromoteLocallyUsedAllocas promoted allocas, it didn't rememberChris Lattner2007-08-04
| | | | | | | | to increment NumLocalPromoted, and didn't actually delete the dead alloca, leading to an extra iteration of mem2reg. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40817 91177308-0d34-0410-b5e6-96231b3b80d8
* std::map -> DenseMapChris Lattner2007-08-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40816 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a logic bug where we wouldn't promote single store allocas if the Chris Lattner2007-08-04
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40813 91177308-0d34-0410-b5e6-96231b3b80d8
* When we do the single-store optimization, delete both the storeChris Lattner2007-08-04
| | | | | | | | | and the alloca so they don't get reprocessed. This speeds up PR1432 from 2.20s to 2.17s. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40812 91177308-0d34-0410-b5e6-96231b3b80d8
* Three improvements:Chris Lattner2007-08-04
| | | | | | | | | | | | | | | 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%) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40811 91177308-0d34-0410-b5e6-96231b3b80d8
* switch from using a std::set to using a SmallPtrSet. This speeds up theChris Lattner2007-08-04
| | | | | | | testcase in PR1432 from 6.33s to 2.90s (2.22x) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40810 91177308-0d34-0410-b5e6-96231b3b80d8
* In mem2reg, when handling the single-store case, make sure to removeChris Lattner2007-08-04
| | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40809 91177308-0d34-0410-b5e6-96231b3b80d8
* split rewriting of single-store allocas into its ownChris Lattner2007-08-04
| | | | | | | method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40806 91177308-0d34-0410-b5e6-96231b3b80d8
* refactor some code to shrink PromoteMem2Reg::run a bitChris Lattner2007-08-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40805 91177308-0d34-0410-b5e6-96231b3b80d8
* add a typedef, no other change.Chris Lattner2007-08-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40804 91177308-0d34-0410-b5e6-96231b3b80d8
* avoid an unneeded vector copy. This speeds up mem2reg on the testcase Chris Lattner2007-08-04
| | | | | | | in PR1432 by 6% git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40803 91177308-0d34-0410-b5e6-96231b3b80d8
* make RenamePassWorkList a local var instead of an ivar.Chris Lattner2007-08-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40802 91177308-0d34-0410-b5e6-96231b3b80d8
* Use DominatorTree instead of ETForest.Devang Patel2007-06-07
| | | | | | | This allows faster immediate domiantor walk. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37500 91177308-0d34-0410-b5e6-96231b3b80d8
* Mem2Reg does not need TargetData.Devang Patel2007-04-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36444 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused function argument.Devang Patel2007-04-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36441 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a comment.Owen Anderson2007-04-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36299 91177308-0d34-0410-b5e6-96231b3b80d8
* Move more passes to using ETForest instead of DominatorTree.Owen Anderson2007-04-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36271 91177308-0d34-0410-b5e6-96231b3b80d8
* Reduce malloc/free traffic.Devang Patel2007-03-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35370 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove dead comments.Devang Patel2007-03-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35053 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid recursion. Use iterative algorithm for RenamePass().Devang Patel2007-03-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35052 91177308-0d34-0410-b5e6-96231b3b80d8
* redesign the primary datastructure used by mem2reg to eliminate anChris Lattner2007-02-07
| | | | | | | std::map of std::vector's (ouch!). This speeds up mem2reg by 10% on 176.gcc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33974 91177308-0d34-0410-b5e6-96231b3b80d8
* With the last change, we no longer need both directions of mapping fromChris Lattner2007-02-05
| | | | | | | | | BBNumbers. Instead of using a bi-directional mapping, just use a single densemap. This speeds up mem2reg on 176.gcc by 8%, from 1.3489 to 1.2485s. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33940 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify use of DFBlocks, this makes no noticable performance difference,Chris Lattner2007-02-05
| | | | | | | but paves the way to eliminate BBNumbers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33938 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch InsertedPHINodes back to SmallPtrSet now that the SmallPtrSet::eraseChris Lattner2007-02-05
| | | | | | | bug is fixed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33932 91177308-0d34-0410-b5e6-96231b3b80d8
* switch a SmallPtrSet back to an std::set for now, this caused problems.Chris Lattner2007-02-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33930 91177308-0d34-0410-b5e6-96231b3b80d8
* switch an std::set over to a SmallPtrSet, speeding up mem2reg 6% on 176.gcc.Chris Lattner2007-02-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33929 91177308-0d34-0410-b5e6-96231b3b80d8
* switch an std::set over to SmallPtrSet, speeding up mem2reg 3.4% on 176.gcc.Chris Lattner2007-02-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33928 91177308-0d34-0410-b5e6-96231b3b80d8
* eliminate some malloc traffic, this speeds up mem2reg by 3.4%.Chris Lattner2007-02-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33927 91177308-0d34-0410-b5e6-96231b3b80d8
* s|llvm/Support/Visibility.h|llvm/Support/Compiler.h|Chris Lattner2006-08-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29911 91177308-0d34-0410-b5e6-96231b3b80d8
* Use hidden visibility to make symbols in an anonymous namespace getChris Lattner2006-06-28
| | | | | | | dropped. This shrinks libllvmgcc.dylib another 67K git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28975 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some nondeterminstic behavior in the mem2reg pass that (in addition toChris Lattner2006-04-27
| | | | | | | | | | | nondeterminism being bad) could cause some trivial missed optimizations (dead phi nodes being left around for later passes to clean up). With this, llvm-gcc4 now bootstraps and correctly compares. I don't know why I never tried to do it before... :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27984 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement a refinement to the mem2reg algorithm for cases where an allocaChris Lattner2005-11-18
| | | | | | | | | | | has a single def. In this case, look for uses that are dominated by the def and attempt to rewrite them to directly use the stored value. This speeds up mem2reg on these values and reduces the number of phi nodes inserted. This should address PR665. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24411 91177308-0d34-0410-b5e6-96231b3b80d8
* This needs proper dominanceChris Lattner2005-11-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24410 91177308-0d34-0410-b5e6-96231b3b80d8
* This code can handle non-dominating instructionsChris Lattner2005-08-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22667 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a fixme in CondPropagate.cpp by moving a PhiNode optimization intoNate Begeman2005-08-04
| | | | | | | | | BasicBlock's removePredecessor routine. This requires shuffling around the definition and implementation of hasContantValue from Utils.h,cpp into Instructions.h,cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22664 91177308-0d34-0410-b5e6-96231b3b80d8