Changes in directory llvm/lib/Transforms/IPO:
InlineSimple.cpp updated: 1.71 -> 1.72 --- Log message: Permit inlining functions that contain dynamic allocations now that InlineFunction handles this case safely. This implements Transforms/Inline/dynamic_alloca_test.ll. --- Diffs of the changes: (+4 -27) InlineSimple.cpp | 31 ++++--------------------------- 1 files changed, 4 insertions(+), 27 deletions(-) Index: llvm/lib/Transforms/IPO/InlineSimple.cpp diff -u llvm/lib/Transforms/IPO/InlineSimple.cpp:1.71 llvm/lib/Transforms/IPO/InlineSimple.cpp:1.72 --- llvm/lib/Transforms/IPO/InlineSimple.cpp:1.71 Tue May 17 23:30:33 2005 +++ llvm/lib/Transforms/IPO/InlineSimple.cpp Fri Jan 13 13:35:43 2006 @@ -33,16 +33,6 @@ // 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 @@ // entry here. std::vector<ArgInfo> 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 @@ // 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<DbgInfoIntrinsic>(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<AllocaInst>(II) && BB != F->begin()) { - HasAllocas = true; - this->NumBlocks = this->NumInsts = 1; - return; - } - } + II != E; ++II) + if (!isa<DbgInfoIntrinsic>(II)) + ++NumInsts; ++NumBlocks; } @@ -218,11 +200,6 @@ 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 _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits