diff options
author | Chris Lattner <sabre@nondot.org> | 2003-11-09 05:05:36 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-11-09 05:05:36 +0000 |
commit | 984e11792fa80aee5d402f3c5e0aa2a4067b582d (patch) | |
tree | 5a91ec8a0c7f437ab014c5f97eb6aa1c8a0f7971 /llvm/lib/Transforms/IPO/Inliner.cpp | |
parent | d61abe82d3636e307bc256e66e6b61e661e896ac (diff) | |
download | bcm5719-llvm-984e11792fa80aee5d402f3c5e0aa2a4067b582d.tar.gz bcm5719-llvm-984e11792fa80aee5d402f3c5e0aa2a4067b582d.zip |
Do NOT inline self recursive calls into other functions. This is causing the
pool allocator no end of trouble, and doesn't make a lot of sense anyway. This
does not solve the problem with mutually recursive functions, but they are much less common.
llvm-svn: 9828
Diffstat (limited to 'llvm/lib/Transforms/IPO/Inliner.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/Inliner.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp index 6c7a1914a95..8ad72ab9a17 100644 --- a/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/llvm/lib/Transforms/IPO/Inliner.cpp @@ -64,10 +64,13 @@ bool Inliner::runOnSCC(const std::vector<CallGraphNode*> &SCC) { if (isa<CallInst>(I) || isa<InvokeInst>(I)) { CallSite CS = CallSite::get(I); if (Function *Callee = CS.getCalledFunction()) - if (!Callee->isExternal()) { + if (!Callee->isExternal() && !IsRecursiveFunction.count(Callee)) { // Determine whether this is a function IN the SCC... bool inSCC = SCCFunctions.count(Callee); + // Keep track of whether this is a directly recursive function. + if (Callee == F) IsRecursiveFunction.insert(F); + // If the policy determines that we should inline this function, // try to do so... int InlineCost = inSCC ? getRecursiveInlineCost(CS) : |