llvm.org GIT mirror llvm / 8a4f939
Merge 98561 from mainline. Avoid sibcall optimization if either caller or callee is using sret semantics. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_27@99290 91177308-0d34-0410-b5e6-96231b3b80d8 Tanya Lattner 10 years ago
2 changed file(s) with 12 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
14761476 DebugLoc dl,
14771477 SelectionDAG &DAG,
14781478 SmallVectorImpl &InVals) {
1479
14801479 MachineFunction &MF = DAG.getMachineFunction();
14811480 X86MachineFunctionInfo *FuncInfo = MF.getInfo();
14821481
17781777
17791778 if (isTailCall) {
17801779 // Check if it's really possible to do a tail call.
1781 isTailCall = IsEligibleForTailCallOptimization(Callee, CallConv, isVarArg,
1780 isTailCall = IsEligibleForTailCallOptimization(Callee, CallConv,
1781 isVarArg, IsStructRet, MF.getFunction()->hasStructRetAttr(),
17821782 Outs, Ins, DAG);
17831783
17841784 // Sibcalls are automatically detected tailcalls which do not require
22962296 X86TargetLowering::IsEligibleForTailCallOptimization(SDValue Callee,
22972297 CallingConv::ID CalleeCC,
22982298 bool isVarArg,
2299 bool isCalleeStructRet,
2300 bool isCallerStructRet,
22992301 const SmallVectorImpl &Outs,
23002302 const SmallVectorImpl &Ins,
23012303 SelectionDAG& DAG) const {
23152317 // Look for obvious safe cases to perform tail call optimization that does not
23162318 // requite ABI changes. This is what gcc calls sibcall.
23172319
2318 // Do not tail call optimize vararg calls for now.
2320 // Do not sibcall optimize vararg calls for now.
23192321 if (isVarArg)
2322 return false;
2323
2324 // Also avoid sibcall optimization if either caller or callee uses struct
2325 // return semantics.
2326 if (isCalleeStructRet || isCallerStructRet)
23202327 return false;
23212328
23222329 // If the callee takes no arguments then go on to check the results of the
636636 bool IsEligibleForTailCallOptimization(SDValue Callee,
637637 CallingConv::ID CalleeCC,
638638 bool isVarArg,
639 bool isCalleeStructRet,
640 bool isCallerStructRet,
639641 const SmallVectorImpl &Outs,
640642 const SmallVectorImpl &Ins,
641643 SelectionDAG& DAG) const;