summaryrefslogtreecommitdiff
path: root/lib/Target/X86
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-11-22 15:18:28 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-11-22 15:18:28 +0000
commit9519b689c843b01a86610b6e633ee0fe155602ba (patch)
tree82dd671c0460921e242b5347ec0e6f1aa6ba2503 /lib/Target/X86
parentd29ed42abd4b109030444d90d01e71d91e5377de (diff)
downloadllvm-9519b689c843b01a86610b6e633ee0fe155602ba.tar.gz
llvm-9519b689c843b01a86610b6e633ee0fe155602ba.tar.bz2
llvm-9519b689c843b01a86610b6e633ee0fe155602ba.tar.xz
Don't produce tail calls when the caller is x86_thiscallcc.
The callee will not pop the stack for us. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195467 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86')
-rw-r--r--lib/Target/X86/X86ISelLowering.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp
index 8320fc1b88..1a15bea0d9 100644
--- a/lib/Target/X86/X86ISelLowering.cpp
+++ b/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