Changes in directory llvm/lib/Transforms/Utils:
InlineFunction.cpp updated: 1.35 -> 1.36 --- Log message: Fix a bug I noticed by inspection: if the first instruction in the inlined function was not an alloca, we wouldn't check the entry block for any allocas, leading to increased stack space in some cases. In practice, allocas are almost always at the top of the block, so this was never noticed. --- Diffs of the changes: (+3 -5) InlineFunction.cpp | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) Index: llvm/lib/Transforms/Utils/InlineFunction.cpp diff -u llvm/lib/Transforms/Utils/InlineFunction.cpp:1.35 llvm/lib/Transforms/Utils/InlineFunction.cpp:1.36 --- llvm/lib/Transforms/Utils/InlineFunction.cpp:1.35 Wed Jul 27 01:12:34 2005 +++ llvm/lib/Transforms/Utils/InlineFunction.cpp Fri Jan 13 12:16:48 2006 @@ -10,9 +10,6 @@ // This file implements inlining of a function into a call site, resolving // parameters and the return value as appropriate. // -// FIXME: This pass should transform alloca instructions in the called function -// into alloca/dealloca pairs! Or perhaps it should refuse to inline them! -// //===----------------------------------------------------------------------===// #include "llvm/Transforms/Utils/Cloning.h" @@ -87,13 +84,14 @@ // calculate which instruction they should be inserted before. We insert the // instructions at the end of the current alloca list. // - if (isa<AllocaInst>(FirstNewBlock->begin())) { + { BasicBlock::iterator InsertPoint = Caller->begin()->begin(); for (BasicBlock::iterator I = FirstNewBlock->begin(), E = FirstNewBlock->end(); I != E; ) if (AllocaInst *AI = dyn_cast<AllocaInst>(I++)) if (isa<Constant>(AI->getArraySize())) { - // Scan for the block of allocas that we can move over. + // Scan for the block of allocas that we can move over, and move them + // all at once. while (isa<AllocaInst>(I) && isa<Constant>(cast<AllocaInst>(I)->getArraySize())) ++I; _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits