[llvm-branch-commits] [llvm-branch] r99621 - in /llvm/branches/Apple/Morbo: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/sibcall.ll

Evan Cheng evan.cheng at apple.com
Fri Mar 26 09:29:11 PDT 2010


Author: evancheng
Date: Fri Mar 26 11:29:10 2010
New Revision: 99621

URL: http://llvm.org/viewvc/llvm-project?rev=99621&view=rev
Log:
Merge: 99620.

Modified:
    llvm/branches/Apple/Morbo/lib/Target/X86/X86ISelLowering.cpp
    llvm/branches/Apple/Morbo/test/CodeGen/X86/sibcall.ll

Modified: llvm/branches/Apple/Morbo/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/Target/X86/X86ISelLowering.cpp?rev=99621&r1=99620&r2=99621&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/Target/X86/X86ISelLowering.cpp Fri Mar 26 11:29:10 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/branches/Apple/Morbo/test/CodeGen/X86/sibcall.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/test/CodeGen/X86/sibcall.ll?rev=99621&r1=99620&r2=99621&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/test/CodeGen/X86/sibcall.ll (original)
+++ llvm/branches/Apple/Morbo/test/CodeGen/X86/sibcall.ll Fri Mar 26 11:29:10 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-branch-commits mailing list