forked from OSchip/llvm-project
				
			Do not sibcall if stack needs to be dynamically aligned.
llvm-svn: 99620
This commit is contained in:
		
							parent
							
								
									7da63a36f1
								
							
						
					
					
						commit
						3365fb1412
					
				| 
						 | 
				
			
			@ -2290,6 +2290,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) &&
 | 
			
		||||
| 
						 | 
				
			
			@ -2301,6 +2302,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 unless the call site is not passing any
 | 
			
		||||
  // arguments.
 | 
			
		||||
  if (isVarArg && !Outs.empty())
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -302,3 +302,14 @@ entry:
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
declare double @bar6(...)
 | 
			
		||||
 | 
			
		||||
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…
	
		Reference in New Issue