[llvm-commits] [llvm] r86353 - in /llvm/trunk: lib/Transforms/Scalar/TailRecursionElimination.cpp test/Transforms/TailCallElim/nocapture.ll

Nick Lewycky nicholas at mxc.ca
Fri Nov 6 23:42:38 PST 2009


Author: nicholas
Date: Sat Nov  7 01:42:38 2009
New Revision: 86353

URL: http://llvm.org/viewvc/llvm-project?rev=86353&view=rev
Log:
Oops, FunctionContainsEscapingAllocas is really used to mean two different
things. Back out part of r86349 for a moment.

Modified:
    llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp
    llvm/trunk/test/Transforms/TailCallElim/nocapture.ll

Modified: llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp?rev=86353&r1=86352&r2=86353&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp Sat Nov  7 01:42:38 2009
@@ -91,6 +91,15 @@
   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 @@
   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 @@
   /// 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)

Modified: llvm/trunk/test/Transforms/TailCallElim/nocapture.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/TailCallElim/nocapture.ll?rev=86353&r1=86352&r2=86353&view=diff

==============================================================================
--- llvm/trunk/test/Transforms/TailCallElim/nocapture.ll (original)
+++ llvm/trunk/test/Transforms/TailCallElim/nocapture.ll Sat Nov  7 01:42:38 2009
@@ -1,4 +1,5 @@
 ; RUN: opt %s -tailcallelim -S | FileCheck %s
+; XFAIL: *
 
 declare void @use(i8* nocapture, i8* nocapture)
 





More information about the llvm-commits mailing list