diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2010-01-30 01:22:00 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2010-01-30 01:22:00 +0000 |
| commit | 70f714fdbeb17ca83768bd098de02e3e8ff89518 (patch) | |
| tree | fe60dfe959ee66aacc9b17b7d58d9808b0b81815 /llvm/lib | |
| parent | 2d5a75b42a55b56426446e2eb8f23af8a50a6fc6 (diff) | |
| download | bcm5719-llvm-70f714fdbeb17ca83768bd098de02e3e8ff89518.tar.gz bcm5719-llvm-70f714fdbeb17ca83768bd098de02e3e8ff89518.zip | |
Allow more tailcall optimization: calls with inputs that are all passed in registers.
llvm-svn: 94873
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 5dbe0bb8f0a..c0ebade2dcd 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -2258,9 +2258,18 @@ X86TargetLowering::IsEligibleForTailCallOptimization(SDValue Callee, return true; // Look for obvious safe cases to perform tail call optimization. - // For now, only consider callees which take no arguments. - if (!Outs.empty()) - return false; + // If the callee takes no arguments then go on to check the results of the + // call. + if (!Outs.empty()) { + // Check if stack adjustment is needed. For now, do not do this if any + // argument is passed on the stack. + SmallVector<CCValAssign, 16> ArgLocs; + CCState CCInfo(CalleeCC, isVarArg, getTargetMachine(), + ArgLocs, *DAG.getContext()); + CCInfo.AnalyzeCallOperands(Outs, CCAssignFnForNode(CalleeCC)); + if (CCInfo.getNextStackOffset()) + return false; + } // If the caller does not return a value, then this is obviously safe. // This is one case where it's safe to perform this optimization even |

