summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86ISelLowering.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-02-02 23:55:14 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-02-02 23:55:14 +0000
commit6f36a083ef84714dd8aeccccc253051fe8fa4f13 (patch)
treeb0337dc5e455c6057d60e43c180bdf82d1d6a477 /llvm/lib/Target/X86/X86ISelLowering.cpp
parentb3cfc2b77ce72c8de31f87f3374911aaf96cf99e (diff)
downloadbcm5719-llvm-6f36a083ef84714dd8aeccccc253051fe8fa4f13.tar.gz
bcm5719-llvm-6f36a083ef84714dd8aeccccc253051fe8fa4f13.zip
Revert 95130.
llvm-svn: 95160
Diffstat (limited to 'llvm/lib/Target/X86/X86ISelLowering.cpp')
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 228244f06bf..d05de21be3d 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -1778,7 +1778,7 @@ EmitTailCallStoreRetAddr(SelectionDAG & DAG, MachineFunction &MF,
}
SDValue
-X86TargetLowering::LowerCall(SDValue Chain, SDValue Callee, const Type *RetTy,
+X86TargetLowering::LowerCall(SDValue Chain, SDValue Callee,
CallingConv::ID CallConv, bool isVarArg,
bool &isTailCall,
const SmallVectorImpl<ISD::OutputArg> &Outs,
@@ -1791,8 +1791,8 @@ X86TargetLowering::LowerCall(SDValue Chain, SDValue Callee, const Type *RetTy,
if (isTailCall)
// Check if it's really possible to do a tail call.
- isTailCall = IsEligibleForTailCallOptimization(Callee, RetTy, CallConv,
- isVarArg, Outs, Ins, DAG);
+ isTailCall = IsEligibleForTailCallOptimization(Callee, CallConv, isVarArg,
+ Outs, Ins, DAG);
assert(!(isVarArg && CallConv == CallingConv::Fast) &&
"Var args not supported with calling convention fastcc");
@@ -2247,7 +2247,6 @@ unsigned X86TargetLowering::GetAlignedArgumentStackSize(unsigned StackSize,
/// optimization should implement this function.
bool
X86TargetLowering::IsEligibleForTailCallOptimization(SDValue Callee,
- const Type *RetTy,
CallingConv::ID CalleeCC,
bool isVarArg,
const SmallVectorImpl<ISD::OutputArg> &Outs,
@@ -2329,7 +2328,14 @@ X86TargetLowering::IsEligibleForTailCallOptimization(SDValue Callee,
return true;
// If the return types match, then it's safe.
- return CallerRetTy == RetTy;
+ // Don't tail call optimize recursive call.
+ GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee);
+ if (!G) return false; // FIXME: common external symbols?
+ if (const Function *CalleeF = dyn_cast<Function>(G->getGlobal())) {
+ const Type *CalleeRetTy = CalleeF->getReturnType();
+ return CallerRetTy == CalleeRetTy;
+ }
+ return false;
}
FastISel *
OpenPOWER on IntegriCloud