mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-03-03 01:48:15 +00:00
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
This commit is contained in:
parent
a1040ce57e
commit
953f23925f
@ -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) :
|
||||
|
@ -51,7 +51,13 @@ struct Inliner : public CallGraphSCCPass {
|
||||
virtual int getRecursiveInlineCost(CallSite CS);
|
||||
|
||||
private:
|
||||
// InlineThreshold - Cache the value here for easy access.
|
||||
unsigned InlineThreshold;
|
||||
|
||||
// IsRecursiveFunction - This contains all functions which are directly
|
||||
// recursive, which we do NOT want to inline into other functions.
|
||||
std::set<Function*> IsRecursiveFunction;
|
||||
|
||||
bool performInlining(CallSite CS, std::set<Function*> &SCC);
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user