Loading llvm/lib/Target/X86/X86ISelLowering.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -2307,6 +2307,7 @@ X86TargetLowering::IsEligibleForTailCallOptimization(SDValue Callee, return false; // If -tailcallopt is specified, make fastcc functions tail-callable. const MachineFunction &MF = DAG.getMachineFunction(); const Function *CallerF = DAG.getMachineFunction().getFunction(); if (GuaranteedTailCallOpt) { if (IsTailCallConvention(CalleeCC) && Loading @@ -2318,6 +2319,11 @@ X86TargetLowering::IsEligibleForTailCallOptimization(SDValue Callee, // Look for obvious safe cases to perform tail call optimization that does not // requite ABI changes. This is what gcc calls sibcall. // Can't do sibcall if stack needs to be dynamically re-aligned. PEI needs to // emit a special epilogue. if (RegInfo->needsStackRealignment(MF)) return false; // Do not sibcall optimize vararg calls for now. if (isVarArg) return false; Loading llvm/test/CodeGen/X86/sibcall.ll +13 −0 Original line number Diff line number Diff line Loading @@ -216,3 +216,16 @@ entry: } declare fastcc %struct.ns* @foo7(%struct.cp* byval align 4, i8 signext) nounwind ssp define void @t19() alignstack(32) nounwind { entry: ; CHECK: t19: ; CHECK: andl $-32 ; CHECK: call {{_?}}foo tail call void @foo() nounwind ret void } declare void @foo() Loading
llvm/lib/Target/X86/X86ISelLowering.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -2307,6 +2307,7 @@ X86TargetLowering::IsEligibleForTailCallOptimization(SDValue Callee, return false; // If -tailcallopt is specified, make fastcc functions tail-callable. const MachineFunction &MF = DAG.getMachineFunction(); const Function *CallerF = DAG.getMachineFunction().getFunction(); if (GuaranteedTailCallOpt) { if (IsTailCallConvention(CalleeCC) && Loading @@ -2318,6 +2319,11 @@ X86TargetLowering::IsEligibleForTailCallOptimization(SDValue Callee, // Look for obvious safe cases to perform tail call optimization that does not // requite ABI changes. This is what gcc calls sibcall. // Can't do sibcall if stack needs to be dynamically re-aligned. PEI needs to // emit a special epilogue. if (RegInfo->needsStackRealignment(MF)) return false; // Do not sibcall optimize vararg calls for now. if (isVarArg) return false; Loading
llvm/test/CodeGen/X86/sibcall.ll +13 −0 Original line number Diff line number Diff line Loading @@ -216,3 +216,16 @@ entry: } declare fastcc %struct.ns* @foo7(%struct.cp* byval align 4, i8 signext) nounwind ssp define void @t19() alignstack(32) nounwind { entry: ; CHECK: t19: ; CHECK: andl $-32 ; CHECK: call {{_?}}foo tail call void @foo() nounwind ret void } declare void @foo()