aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Stop reallocating SunkAddrs for each basic block. When we move to an instructionCameron Zwarich2011-01-061-4/+10
| | | | | | | worklist, the key will need to become std::pair<BasicBlock*, Value*>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122932 91177308-0d34-0410-b5e6-96231b3b80d8
* Add some more statistics to CodeGenPrepare.Cameron Zwarich2011-01-051-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122891 91177308-0d34-0410-b5e6-96231b3b80d8
* Add some stats to CodeGenPrepare to make it easier to speed it up withoutCameron Zwarich2011-01-051-3/+15
| | | | | | | regressing code quality. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122887 91177308-0d34-0410-b5e6-96231b3b80d8
* Use pop_back_val instead of back followed by pop_back.Cameron Zwarich2011-01-051-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122876 91177308-0d34-0410-b5e6-96231b3b80d8
* Use a worklist for later iterations just like ordinary instsimplify. The nextCameron Zwarich2011-01-051-0/+19
| | | | | | | | step is to only process instructions in subloops if they have been modified by an earlier simplification. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122869 91177308-0d34-0410-b5e6-96231b3b80d8
* Change LoopInstSimplify back to a LoopPass. It revisits subloops rather thanCameron Zwarich2011-01-051-10/+36
| | | | | | | | | | | skipping them, but it should probably use a worklist and only revisit those instructions in subloops that have actually changed. It should probably also use a worklist after the first iteration like instsimplify now does. Regardless, it's only 0.3% of opt -O2 time on 403.gcc if it replaces the instcombine placed in the middle of the loop passes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122868 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't bother value numbering instructions with void types in GVN. In theory ↵Owen Anderson2011-01-041-0/+4
| | | | | | | | | | this should allow us to insert fewer things into the value numbering maps, but any speedup is beneath the noise threshold on my machine on 403.gcc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122844 91177308-0d34-0410-b5e6-96231b3b80d8
* Complete the NumberTable --> LeaderTable rename.Owen Anderson2011-01-041-12/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122828 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typo in a comment.Owen Anderson2011-01-041-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122827 91177308-0d34-0410-b5e6-96231b3b80d8
* Prune #include's.Owen Anderson2011-01-041-10/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122826 91177308-0d34-0410-b5e6-96231b3b80d8
* Clarify terminology, settling on referring to what was the "number table" as ↵Owen Anderson2011-01-041-32/+32
| | | | | | | | | the "leader table", and rename methods to make it much more clear what they're doing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122823 91177308-0d34-0410-b5e6-96231b3b80d8
* When removing a value from GVN's leaders list, don't drop the Next pointer ↵Owen Anderson2011-01-041-1/+2
| | | | | | in a corner case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122822 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve the accuracy of the inlining heuristic looking for theDale Johannesen2011-01-041-9/+14
| | | | | | | | | | | | case where a static caller is itself inlined everywhere else, and thus may go away if it doesn't get too big due to inlining other things into it. If there are references to the caller other than calls, it will not be removed; account for this. This results in same-day completion of the case in PR8853. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122821 91177308-0d34-0410-b5e6-96231b3b80d8
* Branch instructions don't produce values, so there's no need to generate a ↵Owen Anderson2011-01-041-5/+3
| | | | | | | | | | value number for them. This avoids adding them to the various value numbering tables, resulting in a minor (~3%) speedup for GVN on 40.gcc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122819 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove commented out code.Owen Anderson2011-01-041-4/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122817 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch to the new style of asterisk placement.Cameron Zwarich2011-01-041-8/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122815 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach loop-idiom to turn a loop containing a memset into a larger memsetChris Lattner2011-01-041-18/+69
| | | | | | | | | | | | | | | | | | when safe. The testcase is basically this nested loop: void foo(char *X) { for (int i = 0; i != 100; ++i) for (int j = 0; j != 100; ++j) X[j+i*100] = 0; } which gets turned into a single memset now. clang -O3 doesn't optimize this yet though due to a phase ordering issue I haven't analyzed yet. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122806 91177308-0d34-0410-b5e6-96231b3b80d8
* restructure this a bit. Initialize the WeakVH with "I", theChris Lattner2011-01-041-11/+14
| | | | | | | | | | instruction *after* the store. The store will always be deleted if the transformation kicks in, so we'd do an N^2 scan of every loop block. Whoops. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122805 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid finding loop back edges when we are not splitting critical edges inCameron Zwarich2011-01-041-2/+4
| | | | | | | CodeGenPrepare (which is the default behavior). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122801 91177308-0d34-0410-b5e6-96231b3b80d8
* Address most of Duncan's review comments. Also, make LoopInstSimplify a simpleCameron Zwarich2011-01-041-37/+15
| | | | | | | | | | | | | FunctionPass. It probably doesn't have a reason to be a LoopPass, as it will probably drop the simple fixed point and either use RPO iteration or Duncan's approach in instsimplify of only revisiting instructions that have changed. The next step is to preserve LoopSimplify. This looks like it won't be too hard, although the pass manager doesn't actually seem to respect when non-loop passes claim to preserve LCSSA or LoopSimplify. This will have to be fixed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122791 91177308-0d34-0410-b5e6-96231b3b80d8
* use the very-handy getTruncateOrZeroExtend helper function, andChris Lattner2011-01-041-14/+6
| | | | | | | | | stop setting NSW: signed overflow is possible. Thanks to Dan for pointing these out. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122790 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix comment.Owen Anderson2011-01-031-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122788 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new addEscapingValue callback to update GlobalsModRef when GVN adds ↵Owen Anderson2011-01-031-2/+19
| | | | | | | | | PHIs of GEPs. For the moment, have GlobalsModRef handle this conservatively by simply removing the value from its maps. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122787 91177308-0d34-0410-b5e6-96231b3b80d8
* Duncan deftly points out that readnone functions aren'tChris Lattner2011-01-031-1/+5
| | | | | | | | invalidated by stores, so they can be handled as 'simple' operations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122785 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify GVN's value expression structure, allowing the elimination of a lot of Owen Anderson2011-01-031-260/+26
| | | | | | | almost-but-not-quite-identical code. No intended functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122760 91177308-0d34-0410-b5e6-96231b3b80d8
* stength reduce my previous patch a bit. The only instructionsChris Lattner2011-01-031-6/+9
| | | | | | | | | | | | that are allowed to have metadata operands are intrinsic calls, and the only ones that take metadata currently return void. Just reject all void instructions, which should not be value numbered anyway. To future proof things, add an assert to the getHashValue impl for calls to check that metadata operands aren't present. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122759 91177308-0d34-0410-b5e6-96231b3b80d8
* fix PR8895: metadata operands don't have a strong use of theirChris Lattner2011-01-031-4/+10
| | | | | | | | | | | | nested values, so they can change and drop to null, which can change the hash and cause havok. It turns out that it isn't a good idea to value number stuff with metadata operands anyway, so... don't. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122758 91177308-0d34-0410-b5e6-96231b3b80d8
* Speed up instsimplify by about 10-15% by not bothering to retryDuncan Sands2011-01-031-8/+19
| | | | | | | | InstructionSimplify on instructions that didn't change since the last time round the loop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122745 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch a worklist in CodeGenPrepare to SmallVector and increase the inlineCameron Zwarich2011-01-031-2/+2
| | | | | | | | | | capacity on the Visited SmallPtrSet. On 403.gcc, this is about a 4.5% speedup of CodeGenPrepare time (which itself is 10% of time spent in the backend). This is progress towards PR8889. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122741 91177308-0d34-0410-b5e6-96231b3b80d8
* earlycse can do trivial with-a-block dead store Chris Lattner2011-01-031-6/+38
| | | | | | | | elimination as well. This deletes 60 stores in 176.gcc that largely come from bitfield code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122736 91177308-0d34-0410-b5e6-96231b3b80d8
* switch the load table to use a recycling bump pointer allocator,Chris Lattner2011-01-031-1/+4
| | | | | | | speeding earlycse up by 6%. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122733 91177308-0d34-0410-b5e6-96231b3b80d8
* now that loads are in their own table, we can implementChris Lattner2011-01-031-1/+12
| | | | | | | | store->load forwarding. This allows EarlyCSE to zap 600 more loads from 176.gcc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122732 91177308-0d34-0410-b5e6-96231b3b80d8
* split loads and calls into separate tables. Loads are now just indexedChris Lattner2011-01-031-42/+74
| | | | | | | by their pointer instead of using MemoryValue to wrap it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122731 91177308-0d34-0410-b5e6-96231b3b80d8
* various cleanups, no functionality change.Chris Lattner2011-01-031-24/+19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122729 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach EarlyCSE to do trivial CSE of loads and read-only calls.Chris Lattner2011-01-031-22/+152
| | | | | | | | | On 176.gcc, this catches 13090 loads and calls, and increases the number of simple instructions CSE'd from 29658 to 36208. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122727 91177308-0d34-0410-b5e6-96231b3b80d8
* rename InstValue to SimpleValue, add some comments.Chris Lattner2011-01-031-26/+41
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122725 91177308-0d34-0410-b5e6-96231b3b80d8
* CMake: Add missing source file.Michael J. Spencer2011-01-031-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122724 91177308-0d34-0410-b5e6-96231b3b80d8
* Allocate nodes for the scoped hash table from a recyling bump pointerChris Lattner2011-01-031-5/+9
| | | | | | | allocator. This speeds up early cse by about 20% git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122723 91177308-0d34-0410-b5e6-96231b3b80d8
* reduce redundancy in the hashing code and other misc cleanups.Chris Lattner2011-01-032-20/+24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122720 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new loop-instsimplify pass, with the intention of replacing the instanceCameron Zwarich2011-01-033-0/+114
| | | | | | | | of instcombine that is currently in the middle of the loop pass pipeline. This commit only checks in the pass; it will hopefully be enabled by default later. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122719 91177308-0d34-0410-b5e6-96231b3b80d8
* fix some pastosChris Lattner2011-01-021-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122718 91177308-0d34-0410-b5e6-96231b3b80d8
* add DEBUG and -stats output to earlycse.Chris Lattner2011-01-022-6/+39
| | | | | | | | Teach it to CSE the rest of the non-side-effecting instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122716 91177308-0d34-0410-b5e6-96231b3b80d8
* Enhance earlycse to do CSE of casts, instsimplify and die.Chris Lattner2011-01-021-4/+141
| | | | | | | | Add a testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122715 91177308-0d34-0410-b5e6-96231b3b80d8
* split dom frontier handling stuff out to its own DominanceFrontier header,Chris Lattner2011-01-0212-31/+23
| | | | | | | | so that Dominators.h is *just* domtree. Also prune #includes a bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122714 91177308-0d34-0410-b5e6-96231b3b80d8
* sketch out a new early cse pass. No functionality yet.Chris Lattner2011-01-022-0/+63
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122713 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a miscompilation of tramp3d-v4: when forming a memcpy, we have to makeChris Lattner2011-01-021-12/+23
| | | | | | | | | sure that the loop we're promoting into a memcpy doesn't mutate the input of the memcpy. Before we were just checking that the dest of the memcpy wasn't mod/ref'd by the loop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122712 91177308-0d34-0410-b5e6-96231b3b80d8
* If a loop iterates exactly once (has backedge count = 0) then don'tChris Lattner2011-01-021-0/+6
| | | | | | | | mess with it. We'd rather peel/unroll it than convert all of its stores into memsets. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122711 91177308-0d34-0410-b5e6-96231b3b80d8
* Also remove functions that use complex constant expressions in terms ofNick Lewycky2011-01-021-5/+18
| | | | | | | another function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122705 91177308-0d34-0410-b5e6-96231b3b80d8
* enhance loop idiom recognition to scan *all* unconditionally executedChris Lattner2011-01-021-8/+39
| | | | | | | | blocks in a loop, instead of just the header block. This makes it more aggressive, able to handle Duncan's Ada examples. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122704 91177308-0d34-0410-b5e6-96231b3b80d8
* make inSubLoop much more efficient.Chris Lattner2011-01-021-4/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122703 91177308-0d34-0410-b5e6-96231b3b80d8