summaryrefslogtreecommitdiff
path: root/lib/Analysis/LoopPass.cpp
Commit message (Collapse)AuthorAge
* Comment: try to clarify loop iteration order.Andrew Trick2013-07-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186774 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable the new LoopInfo algorithm by default.Andrew Trick2012-06-26
| | | | | | | | | | | | | | | | | | | | | | | | The primary advantage is that loop optimizations will be applied in a stable order. This helps debugging and unit test creation. It is also a better overall implementation without pathologically bad performance on deep functions. On large functions (llvm-stress --size=200000 | opt -loops) Before: 0.1263s After: 0.0225s On deep functions (after tweaking llvm-stress, thanks Nadav): Before: 0.2281s After: 0.0227s See r158790 for more comments. The loop tree is now consistently generated in forward order, but loop passes are applied in reverse order over the program. If we have a loop optimization that prefers forward order, that can easily be achieved by adding a different type of LoopPassManager. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159183 91177308-0d34-0410-b5e6-96231b3b80d8
* Take out the debug info probe stuff. It's making some changes toEric Christopher2012-03-23
| | | | | | | the PassManager annoying and should be reimplemented as a decorator on top of existing passes (as should the timing data). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153305 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r138695. Fix PassManager stack depths.Andrew Trick2011-08-29
| | | | | | | Patch by Xiaoyi Guo! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138737 91177308-0d34-0410-b5e6-96231b3b80d8
* Reverting r138695 to see if it fixes clang self host.Andrew Trick2011-08-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138701 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PassManager stack depths.Andrew Trick2011-08-27
| | | | | | | Patch by Xiaoyi Guo! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138695 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapplying r136844.Andrew Trick2011-08-10
| | | | | | | | | | | | | | | | | | | | | An algorithm for incrementally updating LoopInfo within a LoopPassManager. The incremental update should be extremely cheap in most cases and can be used in places where it's not feasible to regenerate the entire loop forest. - "Unloop" is a node in the loop tree whose last backedge has been removed. - Perform reverse dataflow on the block inside Unloop to propagate the nearest loop from the block's successors. - For reducible CFG, each block in unloop is visited exactly once. This is because unloop no longer has a backedge and blocks within subloops don't change parents. - Immediate subloops are summarized by the nearest loop reachable from their exits or exits within nested subloops. - At completion the unloop blocks each have a new parent loop, and each immediate subloop has a new parent. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137276 91177308-0d34-0410-b5e6-96231b3b80d8
* Reverting r136884 updateUnloop, which crashed a linux builder.Andrew Trick2011-08-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136857 91177308-0d34-0410-b5e6-96231b3b80d8
* An algorithm for incrementally updating LoopInfo within aAndrew Trick2011-08-03
| | | | | | | | | | | | | | | | | | | | LoopPassManager. The incremental update should be extremely cheap in most cases and can be used in places where it's not feasible to regenerate the entire loop forest. - "Unloop" is a node in the loop tree whose last backedge has been removed. - Perform reverse dataflow on the block inside Unloop to propagate the nearest loop from the block's successors. - For reducible CFG, each block in unloop is visited exactly once. This is because unloop no longer has a backedge and blocks within subloops don't change parents. - Immediate subloops are summarized by the nearest loop reachable from their exits or exits within nested subloops. - At completion the unloop blocks each have a new parent loop, and each immediate subloop has a new parent. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136844 91177308-0d34-0410-b5e6-96231b3b80d8
* whitespaceAndrew Trick2011-08-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136843 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce DebugInfoProbe. This is used to monitor how llvm optimizer is ↵Devang Patel2011-03-10
| | | | | | | | | | | | | | treating debugging information. It generates output that lools like 8 times line number info lost by Scalar Replacement of Aggregates (SSAUp) 1 times line number info lost by Simplify well-known library calls 12 times variable info lost by Jump Threading git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127381 91177308-0d34-0410-b5e6-96231b3b80d8
* zap dead code.Chris Lattner2010-09-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113073 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r111199; it breaks -debug-pass=Structure output.Dan Gohman2010-08-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111500 91177308-0d34-0410-b5e6-96231b3b80d8
* Make dumpPassStructure be a PMDataManager abstraction, rather thanDan Gohman2010-08-16
| | | | | | | | | | | a Pass abstraction, since that's the level it's actually used at. Rename Pass' dumpPassStructure to dumpPass. This eliminates an awkward use of getAsPass() to convert a PMDataManager* into a Pass* just to permit a dumpPassStructure call. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111199 91177308-0d34-0410-b5e6-96231b3b80d8
* Make LoopPass::getContainedPass return a LoopPass* instead of a Pass*Dan Gohman2010-08-11
| | | | | | | and remove casts from all its callers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110848 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r110396, with fixes to appease the Linux buildbot gods.Owen Anderson2010-08-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110460 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r110396 to fix buildbots.Owen Anderson2010-08-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110410 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't use PassInfo* as a type identifier for passes. Instead, use the ↵Owen Anderson2010-08-05
| | | | | | | | | address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110396 91177308-0d34-0410-b5e6-96231b3b80d8
* Ok, third time's the charm. No changes from last time except the CMakeDavid Greene2010-04-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | source addition. Apparently the buildbots were wrong about failures. --- Add some switches helpful for debugging: -print-before=<Pass Name> Dump IR before running pass <Pass Name>. -print-before-all Dump IR before running each pass. -print-after-all Dump IR after running each pass. These are helpful when tracking down a miscompilation. It is easy to get IR dumps and do diffs on them, etc. To make this work well, add a new getPrinterPass API to Pass so that each kind of pass (ModulePass, FunctionPass, etc.) can create a Pass suitable for dumping out the kind of object the Pass works on. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100249 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 100204. It broke a bunch of tests and apparently changed what passes ↵Evan Cheng2010-04-02
| | | | | | are run during codegen. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100207 91177308-0d34-0410-b5e6-96231b3b80d8
* Let's try this again. Re-apply 100143 including an apparent missingDavid Greene2010-04-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <string> include. For some reason the buildbot choked on this while my builds did not. It's probably due to a difference in system headers. --- Add some switches helpful for debugging: -print-before=<Pass Name> Dump IR before running pass <Pass Name>. -print-before-all Dump IR before running each pass. -print-after-all Dump IR after running each pass. These are helpful when tracking down a miscompilation. It is easy to get IR dumps and do diffs on them, etc. To make this work well, add a new getPrinterPass API to Pass so that each kind of pass (ModulePass, FunctionPass, etc.) can create a Pass suitable for dumping out the kind of object the Pass works on. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100204 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r100143.Eric Christopher2010-04-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100146 91177308-0d34-0410-b5e6-96231b3b80d8
* Add some switches helpful for debugging:David Greene2010-04-01
| | | | | | | | | | | | | | | | | | | | | | | | -print-before=<Pass Name> Dump IR before running pass <Pass Name>. -print-before-all Dump IR before running each pass. -print-after-all Dump IR after running each pass. These are helpful when tracking down a miscompilation. It is easy to get IR dumps and do diffs on them, etc. To make this work well, add a new getPrinterPass API to Pass so that each kind of pass (ModulePass, FunctionPass, etc.) can create a Pass suitable for dumping out the kind of object the Pass works on. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100143 91177308-0d34-0410-b5e6-96231b3b80d8
* s/getNameStr/getName/Benjamin Kramer2010-03-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100011 91177308-0d34-0410-b5e6-96231b3b80d8
* reapply my timer rewrite with a change for PassManager to store Chris Lattner2010-03-30
| | | | | | | timers by pointer instead of by-value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99871 91177308-0d34-0410-b5e6-96231b3b80d8
* revert r99862 which is causing FNT failures.Chris Lattner2010-03-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99870 91177308-0d34-0410-b5e6-96231b3b80d8
* fairly major rewrite of various timing related stuff.Chris Lattner2010-03-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99862 91177308-0d34-0410-b5e6-96231b3b80d8
* eliminate a bunch more unneeded dynamic_cast's.Chris Lattner2010-01-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94156 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix this debug output to handle the case where the loop has been deleted.Dan Gohman2009-09-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82994 91177308-0d34-0410-b5e6-96231b3b80d8
* Include the name of the loop header in debug messages.Dan Gohman2009-09-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82993 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the dominator verification code out of special code embedded withinDan Gohman2009-09-28
| | | | | | | | | | | | | the PassManager code into a regular verifyAnalysis method. Also, reorganize loop verification. Make the LoopPass infrastructure call verifyLoop as needed instead of having LoopInfo::verifyAnalysis check every loop in the function after each looop pass. Add a new command-line argument, -verify-loop-info, to enable the expensive full checking. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82952 91177308-0d34-0410-b5e6-96231b3b80d8
* Move this assert to check the condition as soon as it is known.Dan Gohman2009-09-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82951 91177308-0d34-0410-b5e6-96231b3b80d8
* Extend the StartPassTimer and StopPassTimer functions so that theDan Gohman2009-09-28
| | | | | | | | | code that stops the timer doesn't have to search to find the timer object before it stops the timer. This avoids a lock acquisition and a few other things done with the timer running. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82949 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an old copy+pasto.Dan Gohman2009-09-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82947 91177308-0d34-0410-b5e6-96231b3b80d8
* Extract the code for inserting a loop into the loop queue intoDan Gohman2009-09-27
| | | | | | | a separate function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82946 91177308-0d34-0410-b5e6-96231b3b80d8
* When a loop is deleted, immediately release all of the activeDan Gohman2009-09-27
| | | | | | | | | LoopPasses for that loop. This avoids trouble with the PassManager trying to call verifyAnalysis on them, and frees up some memory sooner rather than later. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82945 91177308-0d34-0410-b5e6-96231b3b80d8
* Delete a bogus comment.Dan Gohman2009-09-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82908 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't try to verify a LoopPass analysis if the loop has been deleted.Dan Gohman2009-09-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80919 91177308-0d34-0410-b5e6-96231b3b80d8
* convert LoopInfo.h and GraphWriter.h to use raw_ostreamChris Lattner2009-08-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79836 91177308-0d34-0410-b5e6-96231b3b80d8
* Call doInitialization(), releaseMemory(), and doFinalization() for ↵Torok Edwin2009-06-29
| | | | | | | | | | | on-the-fly passes as well. Also don't call finalizers for LoopPass if initialization was not called. Add a unittest that tests that these methods are called, in the proper order, and the correct number of times. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74438 91177308-0d34-0410-b5e6-96231b3b80d8
* Before deleting a basic block, give other loop passes a chance cleanup ↵Devang Patel2009-03-25
| | | | | | analysis values, related to the instructions in the basic block. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67719 91177308-0d34-0410-b5e6-96231b3b80d8
* Sprinkle some PrettyStackEntry magic into the passmanager. With this, we nowChris Lattner2009-03-06
| | | | | | | | | | | | | | | | | | get nice and happy stack traces when we crash in an optimizer or codegen. For example, an abort put in UnswitchLoops now looks like this: Stack dump: 0. Program arguments: clang pr3399.c -S -O3 1. <eof> parser at end of file 2. per-module optimization passes 3. Running pass 'CallGraph Pass Manager' on module 'pr3399.c'. 4. Running pass 'Loop Pass Manager' on function '@foo' 5. Running pass 'Unswitch loops' on basic block '%for.inc' Abort git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66260 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a method to ScalarEvolution for telling it when a loop has beenDan Gohman2009-02-17
| | | | | | | | | | | | modified in a way that may effect the trip count calculation. Change IndVars to use this method when it rewrites pointer or floating-point induction variables instead of using a doInitialization method to sneak these changes in before ScalarEvolution has a chance to see the loop. This eliminates the need for LoopPass to depend on ScalarEvolution. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64810 91177308-0d34-0410-b5e6-96231b3b80d8
* Move dumpPassStructure out of line.Dan Gohman2009-02-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64796 91177308-0d34-0410-b5e6-96231b3b80d8
* Tidy up several unbeseeming casts from pointer to intptr_t.Dan Gohman2008-09-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55779 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't call getAnalysisUsage unless -debug-pass is enabled. This speedsChris Lattner2008-08-08
| | | | | | | up the passmgr by avoiding useless work. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54528 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix spelling of "hierarchy" in comments.Dan Gohman2008-07-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53489 91177308-0d34-0410-b5e6-96231b3b80d8
* Keep track of inherited analysis (e.g. dominator tree).Devang Patel2008-07-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53088 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typos in comments. Devang Patel2008-07-01
| | | | | | | Thanks for the feedback! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52978 91177308-0d34-0410-b5e6-96231b3b80d8
* Add dom info verifier.Devang Patel2008-07-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52967 91177308-0d34-0410-b5e6-96231b3b80d8