aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LoopPass.cpp
AgeCommit message (Collapse)AuthorFilesLines
2012-06-26Enable the new LoopInfo algorithm by default.Andrew Trick1-3/+7
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. llvm-svn: 159183
2012-03-23Take out the debug info probe stuff. It's making some changes toEric Christopher1-21/+2
the PassManager annoying and should be reimplemented as a decorator on top of existing passes (as should the timing data). llvm-svn: 153305
2011-08-29Reapply r138695. Fix PassManager stack depths.Andrew Trick1-4/+4
Patch by Xiaoyi Guo! llvm-svn: 138737
2011-08-27Reverting r138695 to see if it fixes clang self host.Andrew Trick1-4/+4
llvm-svn: 138701
2011-08-27Fix PassManager stack depths.Andrew Trick1-4/+4
Patch by Xiaoyi Guo! llvm-svn: 138695
2011-08-10Reapplying r136844.Andrew Trick1-50/+6
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. llvm-svn: 137276
2011-08-04Reverting r136884 updateUnloop, which crashed a linux builder.Andrew Trick1-6/+50
llvm-svn: 136857
2011-08-03An algorithm for incrementally updating LoopInfo within aAndrew Trick1-50/+6
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. llvm-svn: 136844
2011-08-03whitespaceAndrew Trick1-28/+28
llvm-svn: 136843
2011-03-10Introduce DebugInfoProbe. This is used to monitor how llvm optimizer is ↵Devang Patel1-2/+21
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 llvm-svn: 127381
2010-09-04zap dead code.Chris Lattner1-1/+0
llvm-svn: 113073
2010-08-19Revert r111199; it breaks -debug-pass=Structure output.Dan Gohman1-1/+1
llvm-svn: 111500
2010-08-16Make dumpPassStructure be a PMDataManager abstraction, rather thanDan Gohman1-1/+1
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. llvm-svn: 111199
2010-08-11Make LoopPass::getContainedPass return a LoopPass* instead of a Pass*Dan Gohman1-5/+5
and remove casts from all its callers. llvm-svn: 110848
2010-08-06Reapply r110396, with fixes to appease the Linux buildbot gods.Owen Anderson1-3/+3
llvm-svn: 110460
2010-08-06Revert r110396 to fix buildbots.Owen Anderson1-3/+3
llvm-svn: 110410
2010-08-05Don't use PassInfo* as a type identifier for passes. Instead, use the ↵Owen Anderson1-3/+3
address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. llvm-svn: 110396
2010-04-02Ok, third time's the charm. No changes from last time except the CMakeDavid Greene1-0/+40
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. llvm-svn: 100249
2010-04-02Revert 100204. It broke a bunch of tests and apparently changed what passes ↵Evan Cheng1-40/+0
are run during codegen. llvm-svn: 100207
2010-04-02Let's try this again. Re-apply 100143 including an apparent missingDavid Greene1-0/+40
<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. llvm-svn: 100204
2010-04-01Revert r100143.Eric Christopher1-40/+0
llvm-svn: 100146
2010-04-01Add some switches helpful for debugging:David Greene1-0/+40
-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. llvm-svn: 100143
2010-03-31s/getNameStr/getName/Benjamin Kramer1-3/+3
llvm-svn: 100011
2010-03-30reapply my timer rewrite with a change for PassManager to store Chris Lattner1-5/+7
timers by pointer instead of by-value. llvm-svn: 99871
2010-03-30revert r99862 which is causing FNT failures.Chris Lattner1-7/+5
llvm-svn: 99870
2010-03-30fairly major rewrite of various timing related stuff.Chris Lattner1-5/+7
llvm-svn: 99862
2010-01-22eliminate a bunch more unneeded dynamic_cast's.Chris Lattner1-27/+18
llvm-svn: 94156
2009-09-28Fix this debug output to handle the case where the loop has been deleted.Dan Gohman1-1/+2
llvm-svn: 82994
2009-09-28Include the name of the loop header in debug messages.Dan Gohman1-4/+9
llvm-svn: 82993
2009-09-28Move the dominator verification code out of special code embedded withinDan Gohman1-4/+12
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. llvm-svn: 82952
2009-09-28Move this assert to check the condition as soon as it is known.Dan Gohman1-1/+1
llvm-svn: 82951
2009-09-28Extend the StartPassTimer and StopPassTimer functions so that theDan Gohman1-2/+2
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. llvm-svn: 82949
2009-09-27Fix an old copy+pasto.Dan Gohman1-1/+1
llvm-svn: 82947
2009-09-27Extract the code for inserting a loop into the loop queue intoDan Gohman1-3/+7
a separate function. llvm-svn: 82946
2009-09-27When a loop is deleted, immediately release all of the activeDan Gohman1-0/+9
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. llvm-svn: 82945
2009-09-27Delete a bogus comment.Dan Gohman1-1/+0
llvm-svn: 82908
2009-09-03Don't try to verify a LoopPass analysis if the loop has been deleted.Dan Gohman1-1/+3
llvm-svn: 80919
2009-08-23convert LoopInfo.h and GraphWriter.h to use raw_ostreamChris Lattner1-1/+1
llvm-svn: 79836
2009-06-29Call doInitialization(), releaseMemory(), and doFinalization() for ↵Torok Edwin1-0/+3
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. llvm-svn: 74438
2009-03-25Before deleting a basic block, give other loop passes a chance cleanup ↵Devang Patel1-0/+7
analysis values, related to the instructions in the basic block. llvm-svn: 67719
2009-03-06Sprinkle some PrettyStackEntry magic into the passmanager. With this, we nowChris Lattner1-5/+7
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 llvm-svn: 66260
2009-02-17Add a method to ScalarEvolution for telling it when a loop has beenDan Gohman1-3/+0
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. llvm-svn: 64810
2009-02-17Move dumpPassStructure out of line.Dan Gohman1-0/+10
llvm-svn: 64796
2008-09-04Tidy up several unbeseeming casts from pointer to intptr_t.Dan Gohman1-1/+1
llvm-svn: 55779
2008-08-08Don't call getAnalysisUsage unless -debug-pass is enabled. This speedsChris Lattner1-4/+2
up the passmgr by avoiding useless work. llvm-svn: 54528
2008-07-11Fix spelling of "hierarchy" in comments.Dan Gohman1-1/+1
llvm-svn: 53489
2008-07-03Keep track of inherited analysis (e.g. dominator tree).Devang Patel1-0/+3
llvm-svn: 53088
2008-07-01Fix typos in comments. Devang Patel1-1/+1
Thanks for the feedback! llvm-svn: 52978
2008-07-01Add dom info verifier.Devang Patel1-0/+3
llvm-svn: 52967
2007-12-29Remove attribution from file headers, per discussion on llvmdev.Chris Lattner1-2/+2
llvm-svn: 45418