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 | d77922f1a2ed9290544ded8a50d52fd24065556f (patch) | |
| tree | 4c7b8de8347bad3b91570718dd4f9de98da766ed /lib/Transforms/IPO/Inliner.cpp | |
| parent | b045e1411151624623ef58a05406c7d05b4524e7 (diff) | |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9828 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/Inliner.cpp')
| -rw-r--r-- | lib/Transforms/IPO/Inliner.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp index 6c7a1914a9..8ad72ab9a1 100644 --- a/lib/Transforms/IPO/Inliner.cpp +++ b/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) : |
