[llvm-commits] [llvm] r99620 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/sibcall.ll
Evan Cheng
evan.cheng at apple.com
Fri Mar 26 09:26:04 PDT 2010
Author: evancheng
Date: Fri Mar 26 11:26:03 2010
New Revision: 99620
URL: http://llvm.org/viewvc/llvm-project?rev=99620&view=rev
Log:
Do not sibcall if stack needs to be dynamically aligned.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/test/CodeGen/X86/sibcall.ll
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=99620&r1=99619&r2=99620&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Mar 26 11:26:03 2010
@@ -2290,6 +2290,7 @@
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 @@
// 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())
Modified: llvm/trunk/test/CodeGen/X86/sibcall.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sibcall.ll?rev=99620&r1=99619&r2=99620&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/sibcall.ll (original)
+++ llvm/trunk/test/CodeGen/X86/sibcall.ll Fri Mar 26 11:26:03 2010
@@ -302,3 +302,14 @@
}
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()
More information about the llvm-commits
mailing list