diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp index 0d579bc1ff3..4a41bb6af5d 100644 --- a/lib/Transforms/IPO/InlineSimple.cpp +++ b/lib/Transforms/IPO/InlineSimple.cpp @@ -33,16 +33,6 @@ namespace { // FunctionInfo - For each function, calculate the size of it in blocks and // instructions. struct FunctionInfo { - // HasAllocas - Keep track of whether or not a function contains an alloca - // instruction that is not in the entry block of the function. Inlining - // this call could cause us to blow out the stack, because the stack memory - // would never be released. - // - // FIXME: LLVM needs a way of dealloca'ing memory, which would make this - // irrelevant! - // - bool HasAllocas; - // NumInsts, NumBlocks - Keep track of how large each function is, which is // used to estimate the code size cost of inlining it. unsigned NumInsts, NumBlocks; @@ -53,7 +43,7 @@ namespace { // entry here. std::vector ArgumentWeights; - FunctionInfo() : HasAllocas(false), NumInsts(0), NumBlocks(0) {} + FunctionInfo() : NumInsts(0), NumBlocks(0) {} /// analyzeFunction - Fill in the current structure with information gleaned /// from the specified function. @@ -148,17 +138,9 @@ void FunctionInfo::analyzeFunction(Function *F) { // each instruction counts as 10. for (Function::const_iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { for (BasicBlock::const_iterator II = BB->begin(), E = BB->end(); - II != E; ++II) { - if (!isa(II)) ++NumInsts; - - // If there is an alloca in the body of the function, we cannot currently - // inline the function without the risk of exploding the stack. - if (isa(II) && BB != F->begin()) { - HasAllocas = true; - this->NumBlocks = this->NumInsts = 1; - return; - } - } + II != E; ++II) + if (!isa(II)) + ++NumInsts; ++NumBlocks; } @@ -218,11 +200,6 @@ int SimpleInliner::getInlineCost(CallSite CS) { if (CalleeFI.NumBlocks == 0) CalleeFI.analyzeFunction(Callee); - // Don't inline calls to functions with allocas that are not in the entry - // block of the function. - if (CalleeFI.HasAllocas) - return 2000000000; - // Add to the inline quality for properties that make the call valuable to // inline. This includes factors that indicate that the result of inlining // the function will be optimizable. Currently this just looks at arguments