diff options
| author | Nick Lewycky <nicholas@mxc.ca> | 2009-11-07 07:42:38 +0000 |
|---|---|---|
| committer | Nick Lewycky <nicholas@mxc.ca> | 2009-11-07 07:42:38 +0000 |
| commit | 9b669b3c4fa3222888935ab6d88ab3174b4c95b8 (patch) | |
| tree | 83c51f0be812e93625db7acc936a791c60f23c15 /llvm/lib/Transforms | |
| parent | f5dc6fa252cea10cae0495fdf4357f752bf039e1 (diff) | |
| download | bcm5719-llvm-9b669b3c4fa3222888935ab6d88ab3174b4c95b8.tar.gz bcm5719-llvm-9b669b3c4fa3222888935ab6d88ab3174b4c95b8.zip | |
Oops, FunctionContainsEscapingAllocas is really used to mean two different
things. Back out part of r86349 for a moment.
llvm-svn: 86353
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp b/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp index 1b8ed4127c4..e05991373a8 100644 --- a/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp +++ b/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp @@ -91,6 +91,15 @@ FunctionPass *llvm::createTailCallEliminationPass() { return new TailCallElim(); } +/// AllocaMightEscapeToCalls - Return true if this alloca may be accessed by +/// callees of this function. We only do very simple analysis right now, this +/// could be expanded in the future to use mod/ref information for particular +/// call sites if desired. +static bool AllocaMightEscapeToCalls(AllocaInst *AI) { + // FIXME: do simple 'address taken' analysis. + return true; +} + /// CheckForEscapingAllocas - Scan the specified basic block for alloca /// instructions. If it contains any that might be accessed by calls, return /// true. @@ -99,7 +108,7 @@ static bool CheckForEscapingAllocas(BasicBlock *BB, bool RetVal = false; for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) if (AllocaInst *AI = dyn_cast<AllocaInst>(I)) { - RetVal |= PointerMayBeCaptured(AI, true); + RetVal |= AllocaMightEscapeToCalls(AI); // If this alloca is in the body of the function, or if it is a variable // sized allocation, we cannot tail call eliminate calls marked 'tail' @@ -145,7 +154,6 @@ bool TailCallElim::runOnFunction(Function &F) { /// happen. This bug is PR962. if (FunctionContainsEscapingAllocas) return false; - // Second pass, change any tail calls to loops. for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) |

