summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
Commit message (Collapse)AuthorAge
...
* Eliminate all remaining tabs and trailing spaces.Jeff Cohen2005-07-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22523 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR590 and Transforms/Mem2Reg/2005-06-30-ReadBeforeWrite.ll.Chris Lattner2005-06-30
| | | | | | | | | The optimization for locally used allocas was not safe for allocas that were read before they were written. This change disables that optimization in that case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22318 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove trailing whitespaceMisha Brukman2005-04-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21427 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix test/Regression/Transforms/LICM/2004-09-14-AliasAnalysisInvalidate.llxChris Lattner2004-11-30
| | | | | | | This only fails on darwin or on X86 under valgrind. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18377 91177308-0d34-0410-b5e6-96231b3b80d8
* Correction to allow compilation with Visual C++.Reid Spencer2004-10-18
| | | | | | | Patch contributed by Morten Ofstad. Thanks Morten! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17123 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bug that occurs when the constant value is the result of an invoke. InChris Lattner2004-10-18
| | | | | | | | particular, invoke ret values are only live in the normal dest of the invoke not in the unwind dest. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17108 91177308-0d34-0410-b5e6-96231b3b80d8
* When inserting PHI nodes, don't insert any phi nodes that are obviouslyChris Lattner2004-10-17
| | | | | | | | | | unneccesary. This allows us to delete several hundred phi nodes of the form PHI(x,x,x,undef) from 253.perlbmk and probably other programs as well. This implements Mem2Reg/UndefValuesMerge.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17098 91177308-0d34-0410-b5e6-96231b3b80d8
* When promoting mem2reg, make uninitialized values become undef isntead of 0.Chris Lattner2004-10-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17045 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove a whole bunch of horrible hacky code that was used to promote allocasChris Lattner2004-09-19
| | | | | | | | | | whose addresses where used by trivial phi nodes and select instructions. This is now performed by the instcombine pass, which is more powerful, is much simpler, and is faster. This allows the deletion of a bunch of code, two FIXME's and two gotos. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16406 91177308-0d34-0410-b5e6-96231b3b80d8
* Make sure to remove the Select instruction as wellChris Lattner2004-09-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16389 91177308-0d34-0410-b5e6-96231b3b80d8
* If given an AliasSetTracker object to update, update it.Chris Lattner2004-09-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16347 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixes to make LLVM compile with vc7.1.Alkis Evlogimenos2004-09-03
| | | | | | | Patch contributed by Paolo Invernizzi! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16152 91177308-0d34-0410-b5e6-96231b3b80d8
* Changes For Bug 352Reid Spencer2004-09-01
| | | | | | | | | Move include/Config and include/Support into include/llvm/Config, include/llvm/ADT and include/llvm/Support. From here on out, all LLVM public header files must be under include/llvm/. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16137 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix #includes of i*.h => Instructions.h as per PR403.Misha Brukman2004-07-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15334 91177308-0d34-0410-b5e6-96231b3b80d8
* Change to use the StableBasicBlockNumbering classChris Lattner2004-06-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14247 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not let the numbering of PHI nodes placed in the function depend onChris Lattner2004-06-19
| | | | | | | | | | | | | | | | | | | | non-deterministic things like the ordering of blocks in the dominance frontier of a BB. Unfortunately, I don't know of a better way to solve this problem than to explicitly sort the BB's in function-order before processing them. This is guaranteed to slow the pass down a bit, but is absolutely necessary to get usable diffs between two different tools executing the mem2reg or scalarrepl pass. Before this, bazillions of spurious diff failures occurred all over the place due to the different order of processing PHIs: - %tmp.111 = getelementptr %struct.Connector_struct* %upcon.0.0, uint 0, uint 0 + %tmp.111 = getelementptr %struct.Connector_struct* %upcon.0.1, uint 0, uint 0 Now, the diffs match. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14244 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement ScalarRepl/select_promote.llChris Lattner2004-04-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12779 91177308-0d34-0410-b5e6-96231b3b80d8
* Bunch up all locally used allocas by the block they are allocated in, andChris Lattner2004-02-03
| | | | | | | | process them all as a group. This speeds up SRoA/mem2reg from 28.46s to 0.62s on the testcase from PR209. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11100 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle extremely trivial cases extremely efficiently. This speeds upChris Lattner2004-02-03
| | | | | | | SRoA/mem2reg from 41.2s to 27.5s on the testcase in PR209. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11099 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement Transforms/ScalarRepl/phinodepromote.ll, which is an importantChris Lattner2004-01-12
| | | | | | | case that the C/C++ front-end generates. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10761 91177308-0d34-0410-b5e6-96231b3b80d8
* Finegrainify namespacificationChris Lattner2004-01-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10727 91177308-0d34-0410-b5e6-96231b3b80d8
* Put all LLVM code into the llvm namespace, as per bug 109.Brian Gaeke2003-11-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9903 91177308-0d34-0410-b5e6-96231b3b80d8
* Added LLVM project notice to the top of every C++ source file.John Criswell2003-10-20
| | | | | | | Header files will be on the way. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9298 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR#50Chris Lattner2003-10-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9227 91177308-0d34-0410-b5e6-96231b3b80d8
* This changes the PromoteMemToReg function to create "pruned" SSA form, notChris Lattner2003-10-05
| | | | | | | | | | | | | | | | | | | | | "minimal" SSA form (in other words, it doesn't insert dead PHIs). This speeds up the mem2reg pass very significantly because it doesn't have to do a lot of frivolous work in many common cases. In the 252.eon function I have been playing with, this doesn't even insert the 120 PHI nodes that it used to which were trivially dead (in the process of promoting 356 alloca instructions overall). This speeds up the mem2reg pass from 1.2459s to 0.1284s. More significantly, the DCE pass used to take 2.4138s to remove the 120 dead PHI nodes that mem2reg constructed, now it takes 0.0134s (which is the time to scan the function and decide that there is nothing dead). So overall, on this one function, we speed things up a total of 3.5179s, which is a 24.8x speedup! :) This change is tested by the Mem2Reg/2003-10-05-DeadPHIInsertion.ll test, which now passes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8884 91177308-0d34-0410-b5e6-96231b3b80d8
* Change the interface to PromoteMemToReg to also take a DominatorTreeChris Lattner2003-10-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8883 91177308-0d34-0410-b5e6-96231b3b80d8
* Speed up the mem2reg transform for allocas which are only read/written in a ↵Chris Lattner2003-10-05
| | | | | | | | | | | | | | | | | | | | | | | | single basic block. This is amazingly common in code generated by the C/C++ front-ends. This change makes it not have to insert ANY phi nodes, whereas before it would insert a ton of dead ones which DCE would have to clean up. Thus, this fix improves compile-time performance of these trivial allocas in two ways: 1. It doesn't have to do the walking and book-keeping for renaming 2. It does not insert dead phi nodes for them which would have to subsequently be cleaned up. On my favorite testcase from 252.eon, this special case handles 305 out of 356 promoted allocas in the function. It speeds up the mem2reg pass from 7.5256s to 1.2505s. It inserts 677 fewer dead PHI nodes, which speeds up a subsequent -dce pass from 18.7524s to 2.4806s. There are still 120 trivially dead PHI nodes being inserted for variables used in multiple basic blocks, but they are not handled by this patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8881 91177308-0d34-0410-b5e6-96231b3b80d8
* The first PHI node may be null, scan for the first non-null oneChris Lattner2003-10-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8865 91177308-0d34-0410-b5e6-96231b3b80d8
* The VersionNumbers vector is only used during PHI placement. Turn it into ↵Chris Lattner2003-10-05
| | | | | | an argument, allowing us to get rid of the vector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8864 91177308-0d34-0410-b5e6-96231b3b80d8
* * Update file header commentChris Lattner2003-10-05
| | | | | | | | | | | | | | *** Revamp the code which handled unreachable code in the function. Now the code is much more efficient for high-degree basic blocks, such as those that occur in the 252.eon SPEC benchmark. For the interested, the time to promote a SINGLE alloca in _ZN7mrScene4ReadERSi function used to be > 3.5s. Now it is < .075s. The function has a LOT of allocas in it, so it appeared to be infinite looping, this should make it much nicer. :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8863 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify the loop a bitChris Lattner2003-10-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8862 91177308-0d34-0410-b5e6-96231b3b80d8
* There is no need for separate WriteSets and PhiNodeBlocks lists. It is just aChris Lattner2003-10-05
| | | | | | | | work-list of value definitions. This allows elimination of the explicit 'iterative' step of the algorithm, and also reuses temporary memory better. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8861 91177308-0d34-0410-b5e6-96231b3b80d8
* The PhiNodes 2D vector is only used during PHI node placement. It doesn'tChris Lattner2003-10-05
| | | | | | | need to be an instance variable! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8860 91177308-0d34-0410-b5e6-96231b3b80d8
* * Document instance vars betterChris Lattner2003-10-05
| | | | | | | | * Fuse two parallel loops * Use a more specific type for AllocaLookup git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8859 91177308-0d34-0410-b5e6-96231b3b80d8
* Two small cleanups/speedups:Chris Lattner2003-10-05
| | | | | | | | * Do not insert a new entry into NewPhiNodes during the rename pass if there are no PHIs in a block. * Do not compute WriteSets in parallel git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8858 91177308-0d34-0410-b5e6-96231b3b80d8
* * Minor cleanupsChris Lattner2003-10-05
| | | | | | | | | * Eliminate the KillList instance variable, instead, just delete loads and stores as they are "renamed", and delete allocas when they are done * Make the 'visited' set an instance variable to avoid passing it on the stack. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8857 91177308-0d34-0410-b5e6-96231b3b80d8
* Spell `necessary' correctly.Misha Brukman2003-08-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7944 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix bug: mem2reg/2003-04-24-MultipleIdenticalSuccessors.llChris Lattner2003-04-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5919 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix iterator invalidation problemChris Lattner2003-04-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5895 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix bug where use still existed in dead codeChris Lattner2003-04-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5824 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix bug: Mem2reg/2003-04-18-DeadBlockProblem.llChris Lattner2003-04-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5810 91177308-0d34-0410-b5e6-96231b3b80d8
* * Fix bug: Mem2Reg/2003-04-10-DFNotFound.llChris Lattner2003-04-10
| | | | | | | | * Make Mem2Reg assign version numbers now for renamed variables instead of .mem2reg suffixes. This produces what people think of as SSA. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5771 91177308-0d34-0410-b5e6-96231b3b80d8
* Change the mem2reg interface to accept a TargetData argumentChris Lattner2003-03-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5685 91177308-0d34-0410-b5e6-96231b3b80d8
* Split mem2reg promotion into two parts: a function which does the work, andChris Lattner2003-02-22
| | | | | | | a pass which wraps the function. This allows other passes to use the functionality git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5610 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up std namespace referencesChris Lattner2003-02-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5608 91177308-0d34-0410-b5e6-96231b3b80d8
* - Rename AnalysisUsage::preservesAll to getPreservesAll & preservesCFG toChris Lattner2002-10-21
| | | | | | | setPreservesCFG to be less confusing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4255 91177308-0d34-0410-b5e6-96231b3b80d8
* Updates to work with recent Statistic's changes:Chris Lattner2002-10-01
| | | | | | | | | | | | | * Renamed StatisticReporter.h/cpp to Statistic.h/cpp * Broke constructor to take two const char * arguments instead of one, so that indendation can be taken care of automatically. * Sort the list by pass name when printing * Make sure to print all statistics as a group, instead of randomly when the statistics dtors are called. * Updated ProgrammersManual with new semantics. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4002 91177308-0d34-0410-b5e6-96231b3b80d8
* - Fix bug: Mem2Reg/2002-05-01-ShouldNotPromoteThisAlloca.llChris Lattner2002-09-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3917 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up code due to auto-insert constructorsChris Lattner2002-09-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3665 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminated the MemAccessInst class, folding contents into GEP class.Chris Lattner2002-08-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3487 91177308-0d34-0410-b5e6-96231b3b80d8