summaryrefslogtreecommitdiff
path: root/lib/Analysis/LoopPass.cpp
Commit message (Collapse)AuthorAge
* Add back functionality removed in r210497.Richard Trieu2014-06-21
| | | | | | | Instead of asserting, output a message stating that a null pointer was found. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211430 91177308-0d34-0410-b5e6-96231b3b80d8
* Removing an "if (!this)" check from two print methods. The condition willRichard Trieu2014-06-09
| | | | | | | | never be true in a well-defined context. The checking for null pointers has been moved into the caller logic so it does not rely on undefined behavior. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210497 91177308-0d34-0410-b5e6-96231b3b80d8
* Add C API for thread yielding callback.Juergen Ributzka2014-05-16
| | | | | | | | | | | | | | | | | | | | | Sometimes a LLVM compilation may take more time then a client would like to wait for. The problem is that it is not possible to safely suspend the LLVM thread from the outside. When the timing is bad it might be possible that the LLVM thread holds a global mutex and this would block any progress in any other thread. This commit adds a new yield callback function that can be registered with a context. LLVM will try to yield by calling this callback function, but there is no guaranteed frequency. LLVM will only do so if it can guarantee that suspending the thread won't block any forward progress in other LLVM contexts in the same process. Once the client receives the call back it can suspend the thread safely and resume it at another time. Related to <rdar://problem/16728690> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208945 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Make Support/Debug.h modular. This requires it to not changeChandler Carruth2014-04-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | behavior based on other files defining DEBUG_TYPE, which means it cannot define DEBUG_TYPE at all. This is actually better IMO as it forces folks to define relevant DEBUG_TYPEs for their files. However, it requires all files that currently use DEBUG(...) to define a DEBUG_TYPE if they don't already. I've updated all such files in LLVM and will do the same for other upstream projects. This still leaves one important change in how LLVM uses the DEBUG_TYPE macro going forward: we need to only define the macro *after* header files have been #include-ed. Previously, this wasn't possible because Debug.h required the macro to be pre-defined. This commit removes that. By defining DEBUG_TYPE after the includes two things are fixed: - Header files that need to provide a DEBUG_TYPE for some inline code can do so by defining the macro before their inline code and undef-ing it afterward so the macro does not escape. - We no longer have rampant ODR violations due to including headers with different DEBUG_TYPE definitions. This may be mostly an academic violation today, but with modules these types of violations are easy to check for and potentially very relevant. Where necessary to suppor headers with DEBUG_TYPE, I have moved the definitions below the includes in this commit. I plan to move the rest of the DEBUG_TYPE macros in LLVM in subsequent commits; this one is big enough. The comments in Debug.h, which were hilariously out of date already, have been updated to reflect the recommended practice going forward. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206822 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] More 'nullptr' conversion. In some cases just using a boolean check ↵Craig Topper2014-04-15
| | | | | | instead of comparing to nullptr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206243 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-05
| | | | | | class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202945 91177308-0d34-0410-b5e6-96231b3b80d8
* Constify the Optnone checks in IR passes.Paul Robinson2014-02-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202213 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable most IR-level transform passes on functions marked 'optnone'.Paul Robinson2014-02-06
| | | | | | | | | | Ideally only those transform passes that run at -O0 remain enabled, in reality we get as close as we reasonably can. Passes are responsible for disabling themselves, it's not the job of the pass manager to do it for them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200892 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Rename the IR printing pass header to a more generic and correctChandler Carruth2014-01-12
| | | | | | | | name to match the source file which I got earlier. Update the include sites. Also modernize the comments in the header to use the more recommended doxygen style. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199041 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the LLVM IR asm writer header files into the IR directory, as theyChandler Carruth2014-01-07
| | | | | | | | | | | | | | | | | are part of the core IR library in order to support dumping and other basic functionality. Rename the 'Assembly' include directory to 'AsmParser' to match the library name and the only functionality left their -- printing has been in the core IR library for quite some time. Update all of the #includes to match. All of this started because I wanted to have the layering in good shape before I started adding support for printing LLVM IR using the new pass infrastructure, and commandline support for the new pass infrastructure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198688 91177308-0d34-0410-b5e6-96231b3b80d8
* 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