Undo r94946 now all the tests are passing again.
authorEvan Cheng <evan.cheng@apple.com>
Mon, 1 Feb 2010 02:13:39 +0000 (02:13 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Mon, 1 Feb 2010 02:13:39 +0000 (02:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94970 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/tailcall2.ll

index e272d9b92af9ddfa96665bc757e39be139f8d636..5b7629852ee8b3e14a1ced94f8ca0116b91220ff 100644 (file)
@@ -2263,17 +2263,6 @@ X86TargetLowering::IsEligibleForTailCallOptimization(SDValue Callee,
   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 @@ X86TargetLowering::IsEligibleForTailCallOptimization(SDValue Callee,
     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;
 }
index e78e213d646f37db47e8dd58898e0a2d033b02b9..1e288f57651228a4501ec845b07571c8b0f39656 100644 (file)
@@ -73,7 +73,7 @@ entry:
 ; 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