mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 02:33:33 +00:00
Oops, FunctionContainsEscapingAllocas is really used to mean two different
things. Back out part of r86349 for a moment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86353 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0cade26132
commit
cb19438f63
@ -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'
|
||||
@ -146,7 +155,6 @@ bool TailCallElim::runOnFunction(Function &F) {
|
||||
if (FunctionContainsEscapingAllocas)
|
||||
return false;
|
||||
|
||||
|
||||
// Second pass, change any tail calls to loops.
|
||||
for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
|
||||
if (ReturnInst *Ret = dyn_cast<ReturnInst>(BB->getTerminator()))
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt %s -tailcallelim -S | FileCheck %s
|
||||
; XFAIL: *
|
||||
|
||||
declare void @use(i8* nocapture, i8* nocapture)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user