diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-11-22 15:18:28 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-11-22 15:18:28 +0000 |
| commit | 5a8e985ad34319f274c47641a2194929e5d6babf (patch) | |
| tree | 13ff8ec8587c91940f62322405cbb224b1812be2 /llvm/lib/Target | |
| parent | 4d05874ba2e1a7116c1eac22ab0eca537795cb75 (diff) | |
| download | bcm5719-llvm-5a8e985ad34319f274c47641a2194929e5d6babf.tar.gz bcm5719-llvm-5a8e985ad34319f274c47641a2194929e5d6babf.zip | |
Don't produce tail calls when the caller is x86_thiscallcc.
The callee will not pop the stack for us.
llvm-svn: 195467
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 8320fc1b882..1a15bea0d92 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -3092,9 +3092,13 @@ X86TargetLowering::IsEligibleForTailCallOptimization(SDValue Callee, if (isCalleeStructRet || isCallerStructRet) return false; - // An stdcall caller is expected to clean up its arguments; the callee - // isn't going to do that. - if (!CCMatch && CallerCC == CallingConv::X86_StdCall) + // An stdcall/thiscall caller is expected to clean up its arguments; the + // callee isn't going to do that. + // FIXME: this is more restrictive than needed. We could produce a tailcall + // when the stack adjustment matches. For example, with a thiscall that takes + // only one argument. + if (!CCMatch && (CallerCC == CallingConv::X86_StdCall || + CallerCC == CallingConv::X86_ThisCall)) return false; // Do not sibcall optimize vararg calls unless all arguments are passed via |

