[llvm-commits] [llvm] r94970 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/tailcall2.ll

Evan Cheng evan.cheng at apple.com
Sun Jan 31 18:13:40 PST 2010


Author: evancheng
Date: Sun Jan 31 20:13:39 2010
New Revision: 94970

URL: http://llvm.org/viewvc/llvm-project?rev=94970&view=rev
Log:
Undo r94946 now all the tests are passing again.

Modified:
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
    llvm/trunk/test/CodeGen/X86/tailcall2.ll

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=94970&r1=94969&r2=94970&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sun Jan 31 20:13:39 2010
@@ -2263,17 +2263,6 @@
   if (isVarArg)
     return false;
 
-  // Don't tail call optimize recursive call.
-  GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee);
-  const Function *CalleeF = G ? cast<Function>(G->getGlobal()) : 0;
-  if (CallerF == CalleeF)
-    return false;
-  // If it's an indirect call, conversatively return false if the caller's
-  // address is taken.
-  if (!CalleeF &&
-      !isa<ExternalSymbolSDNode>(Callee) && CallerF->hasAddressTaken())
-    return false;
-
   // Look for obvious safe cases to perform tail call optimization.
   // If the callee takes no arguments then go on to check the results of the
   // call.
@@ -2296,7 +2285,10 @@
     return true;
 
   // If the return types match, then it's safe.
+  // Don't tail call optimize recursive call.
+  GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee);
   if (!G) return false;  // FIXME: common external symbols?
+  const Function *CalleeF = cast<Function>(G->getGlobal());
   const Type *CalleeRetTy = CalleeF->getReturnType();
   return CallerRetTy == CalleeRetTy;
 }

Modified: llvm/trunk/test/CodeGen/X86/tailcall2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tailcall2.ll?rev=94970&r1=94969&r2=94970&view=diff

==============================================================================
--- llvm/trunk/test/CodeGen/X86/tailcall2.ll (original)
+++ llvm/trunk/test/CodeGen/X86/tailcall2.ll Sun Jan 31 20:13:39 2010
@@ -73,7 +73,7 @@
 ; 32: call {{_?}}bar
 
 ; 64: t6:
-; 64: callq {{_?}}t6
+; 64: jmp {{_?}}t6
 ; 64: jmp {{_?}}bar
   %0 = icmp slt i32 %x, 10
   br i1 %0, label %bb, label %bb1





More information about the llvm-commits mailing list