diff options
author | Tanya Lattner <tonic@nondot.org> | 2010-03-30 23:01:26 +0000 |
---|---|---|
committer | Tanya Lattner <tonic@nondot.org> | 2010-03-30 23:01:26 +0000 |
commit | 25e67eda533e7bbf5cbf8b9ba3df96c06ef368b4 (patch) | |
tree | 74c6f73b54a2ce166dd0da6a783a269c898c4d7c | |
parent | 1df1d40e9f784189eda90ab855efb11310e6a58b (diff) | |
download | llvm-25e67eda533e7bbf5cbf8b9ba3df96c06ef368b4.zip llvm-25e67eda533e7bbf5cbf8b9ba3df96c06ef368b4.tar.gz llvm-25e67eda533e7bbf5cbf8b9ba3df96c06ef368b4.tar.bz2 |
Merge 99620 from mainline.
Do not sibcall if stack needs to be dynamically aligned.
llvm-svn: 99955
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 6 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/sibcall.ll | 13 |
2 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index ae06ee4..adffb42 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -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) && @@ -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; diff --git a/llvm/test/CodeGen/X86/sibcall.ll b/llvm/test/CodeGen/X86/sibcall.ll index 90315fd..108e522 100644 --- a/llvm/test/CodeGen/X86/sibcall.ll +++ b/llvm/test/CodeGen/X86/sibcall.ll @@ -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() |