summaryrefslogtreecommitdiff
path: root/lib/Analysis/IPA/CallGraphSCCPass.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
* SCC: Change clients to use const, NFCDuncan P. N. Exon Smith2014-04-25
| | | | | | | | | | It's fishy to be changing the `std::vector<>` owned by the iterator, and no one actual does it, so I'm going to remove the ability in a subsequent commit. First, update the users. <rdar://problem/14292693> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207252 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++] Use 'nullptr'.Craig Topper2014-04-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207083 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Fix potential ODR violations by sinking the DEBUG_TYPEChandler Carruth2014-04-22
| | | | | | | | | | definition below all the header #include lines, lib/Analysis/... edition. This one has a bit extra as there were *other* #define's before #include lines in addition to DEBUG_TYPE. I've sunk all of them as a block. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206843 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
* [PM] Split the CallGraph out from the ModulePass which creates theChandler Carruth2013-11-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CallGraph. This makes the CallGraph a totally generic analysis object that is the container for the graph data structure and the primary interface for querying and manipulating it. The pass logic is separated into its own class. For compatibility reasons, the pass provides wrapper methods for most of the methods on CallGraph -- they all just forward. This will allow the new pass manager infrastructure to provide its own analysis pass that constructs the same CallGraph object and makes it available. The idea is that in the new pass manager, the analysis pass's 'run' method returns a concrete analysis 'result'. Here, that result is a 'CallGraph'. The 'run' method will typically do only minimal work, deferring much of the work into the implementation of the result object in order to be lazy about computing things, but when (like DomTree) there is *some* up-front computation, the analysis does it prior to handing the result back to the querying pass. I know some of this is fairly ugly. I'm happy to change it around if folks can suggest a cleaner interim state, but there is going to be some amount of unavoidable ugliness during the transition period. The good thing is that this is very limited and will naturally go away when the old pass infrastructure goes away. It won't hang around to bother us later. Next up is the initial new-PM-style call graph analysis. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195722 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the old pass manager infrastructure into a legacy namespace andChandler Carruth2013-11-09
| | | | | | | | | | | | | | | | | | | give the files a legacy prefix in the right directory. Use forwarding headers in the old locations to paper over the name change for most clients during the transitional period. No functionality changed here! This is just clearing some space to reduce renaming churn later on with a new system. Even when the new stuff starts to go in, it is going to be hidden behind a flag and off-by-default as it is still WIP and under development. This patch is specifically designed so that very little out-of-tree code has to change. I'm going to work as hard as I can to keep that the case. Only direct forward declarations of the PassManager class are impacted by this change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194324 91177308-0d34-0410-b5e6-96231b3b80d8
* Move CallGraphSCCPass.h into the Analysis tree; that's where theChandler Carruth2013-01-07
| | | | | | implementation lives already. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171746 91177308-0d34-0410-b5e6-96231b3b80d8
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-02
| | | | | | | | | | | | | | | | | | | | | into their new header subdirectory: include/llvm/IR. This matches the directory structure of lib, and begins to correct a long standing point of file layout clutter in LLVM. There are still more header files to move here, but I wanted to handle them in separate commits to make tracking what files make sense at each layer easier. The only really questionable files here are the target intrinsic tablegen files. But that's a battle I'd rather not fight today. I've updated both CMake and Makefile build systems (I think, and my tests think, but I may have missed something). I've also re-sorted the includes throughout the project. I'll be committing updates to Clang, DragonEgg, and Polly momentarily. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171366 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-03
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
* Add doInitialization and doFinalization methods to ModulePass's, to allow ↵Owen Anderson2012-11-15
| | | | | | | | | them to be re-initialized and reused on multiple Module's. Patch by Pedro Artigas. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168008 91177308-0d34-0410-b5e6-96231b3b80d8
* RefreshCallGraph: ignore 'invoke intrinsic'. IntrinsicInst doesnt not ↵Nuno Lopes2012-06-29
| | | | | | recognize invoke, and shouldnt at this point, since the rest of LLVM codebase doesnt expect invoke of intrinsics git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159441 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
* Silence a bunch (but not all) "variable written but not read" warningsDuncan Sands2011-08-12
| | | | | | | when building with assertions disabled. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137460 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach the CallGraph to ignore calls to intrinsics.John McCall2011-06-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132797 91177308-0d34-0410-b5e6-96231b3b80d8
* dead method.Chris Lattner2010-09-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113077 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
* 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
* use Value* constructor of CallSite to create potentially improper site, and ↵Gabor Greif2010-07-28
| | | | | | test that git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109580 91177308-0d34-0410-b5e6-96231b3b80d8
* fix PR5009 by making CGSCCPM realize that a call was devirtualizedChris Lattner2010-05-01
| | | | | | | | if an indirect call site was removed and a direct one was added, not just if an indirect call site was modified to be direct. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102830 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement rdar://6295824 and PR6724 with two tiny changesChris Lattner2010-05-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that can have a big effect :). The first is to enable the iterative SCC passmanager juice that kicks in when the scc passmgr detects that a function pass has devirtualized a call. In this case, it will rerun all the passes it manages on the SCC, up to the iteration count limit (4). This is useful because a function pass may devirualize a call, and we want the inliner to inline it, or pruneeh to infer stuff about it, etc. The second patch is to add *all* call sites to the DevirtualizedCalls list the inliner uses. This list is about to get renamed, but the jist of this is that the inliner now reconsiders *all* inlined call sites as candidates for further inlining. The intuition is this that in cases like this: f() { g(1); } g(int x) { h(x); } We analyze this bottom up, and may decide that it isn't profitable to inline H into G. Next step, we decide that it is profitable to inline G into F, and do so, which means that F now calls H. Even though the call from G -> H may not have been profitable to inline, the call from F -> H may be (in this case because a constant allows folding etc). In my spot checks, this doesn't have a big impact on code. For example, the LLC output for 252.eon grew from 0.02% (from 317252 to 317308) and 176.gcc actually shrunk by .3% (from 1525612 to 1520964 bytes). 252.eon never iterated in the SCC Passmgr, 176.gcc iterated at most 1 time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102823 91177308-0d34-0410-b5e6-96231b3b80d8
* add a DEBUG call so that -debug lists when CGSCCPM iterates.Chris Lattner2010-04-22
| | | | | | | | | | Fix RefreshCallGraph to use CGN->replaceCallEdge instead of hand rolling its own loop. replaceCallEdge properly maintains the reference counts of the nodes, fixing a crash exposed by the iterative callgraph stuff. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102120 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement (but don't enable) PR6724 and rdar://6295824. In short,Chris Lattner2010-04-21
| | | | | | | | | | | | | | | | | we have RefreshCallGraph detect when a function pass devirtualizes a call, and have CGSCCPassMgr iterate (up to a count) when this happens. This allows (in the example) GVN to devirtualize the call in foo, then the inliner to inline it away. This is not currently enabled because I haven't done any analysis on the (potentially substantial) code size or performance impact of doing this, and guess what, it exposes callgraph updating bugs in various passes. This is progress though, and you can play with it by passing -max-cg-scc-iterations=5 to opt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101973 91177308-0d34-0410-b5e6-96231b3b80d8
* reenable r101565, removing a problematic assertion.Chris Lattner2010-04-17
| | | | | | | | | | | | CGSCC can delete nodes in regions of the callgraph that have already been visited. If new CG nodes are allocated to the same pointer, we shouldn't abort, just handle it correctly by assigning a new number. This should restore stability by removing invalidated pointers that *will* be reused from the densemap in the iterator. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101628 91177308-0d34-0410-b5e6-96231b3b80d8
* disable r101565: an assert is getting triggered. More lurking badness no doubt.Chris Lattner2010-04-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101583 91177308-0d34-0410-b5e6-96231b3b80d8
* building on the new CallGraphSCC abstraction, teach CallGraphSCCPassManager Chris Lattner2010-04-16
| | | | | | | | | | | | | | to keep the node entries in scc_iterator up to date instead of dangling as the SCC mutates. This is a really terrible problem which was causing -g to affect codegen because it would permute the memory image of the compiler process. Thanks to Dale for expertly hunting it down. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101565 91177308-0d34-0410-b5e6-96231b3b80d8
* move ReplaceNode out of line, rename scc_iterator::fini -> isAtEnd().Chris Lattner2010-04-16
| | | | | | | No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101562 91177308-0d34-0410-b5e6-96231b3b80d8
* introduce a new CallGraphSCC class, and pass it aroundChris Lattner2010-04-16
| | | | | | | | | to CallGraphSCCPass's instead of passing around a std::vector<CallGraphNode*>. No functionality change, but now we have a much tidier interface. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101558 91177308-0d34-0410-b5e6-96231b3b80d8
* move PrintCallGraphPass out of the middle of CGPassManager.Chris Lattner2010-04-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101543 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
* 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 dynamic_cast from this file.Chris Lattner2010-01-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94157 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
* eliminate a bunch of dynamic_cast's.Chris Lattner2010-01-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94155 91177308-0d34-0410-b5e6-96231b3b80d8
* Change dbgs() back to errs() for assert messages as Chris requested.David Greene2009-12-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92080 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert debug messages to use dbgs(). Generally this meansDavid Greene2009-12-23
| | | | | | | s/errs/dbgs/g except for certain special cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92035 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