diff options
author | Hans Wennborg <hans@hanshq.net> | 2016-09-30 20:07:35 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2016-09-30 20:07:35 +0000 |
commit | b5643b47b6d2c07b2fd30b077e5fac3a0753c2ff (patch) | |
tree | ee252dcaf37043c0c1cd4d6dc99381bf239811c4 /llvm/lib/Target/X86/X86InstrInfo.cpp | |
parent | 2cd87a0cf2008d74de5c1ed5b061d57bdd527481 (diff) | |
download | bcm5719-llvm-b5643b47b6d2c07b2fd30b077e5fac3a0753c2ff.tar.gz bcm5719-llvm-b5643b47b6d2c07b2fd30b077e5fac3a0753c2ff.zip |
X86: Allow conditional tail calls in Win64 "leaf" functions (PR26302)
We can't use Jcc to leave a Win64 function in general, because that
confuses the unwinder. However, for "leaf" functions, that is, functions
where the return address is always on top of the stack and which don't
have unwind info, it's OK.
Differential Revision: https://reviews.llvm.org/D24836
llvm-svn: 282920
Diffstat (limited to 'llvm/lib/Target/X86/X86InstrInfo.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86InstrInfo.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp index a71aac10c83..fd3849f95bf 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.cpp +++ b/llvm/lib/Target/X86/X86InstrInfo.cpp @@ -4240,9 +4240,9 @@ bool X86InstrInfo::canMakeTailCallConditional( return false; } - if (Subtarget.isTargetWin64()) { + const MachineFunction *MF = TailCall.getParent()->getParent(); + if (Subtarget.isTargetWin64() && MF->hasWinCFI()) { // Conditional tail calls confuse the Win64 unwinder. - // TODO: Allow them for "leaf" functions; PR30337. return false; } @@ -4252,8 +4252,7 @@ bool X86InstrInfo::canMakeTailCallConditional( return false; } - const X86MachineFunctionInfo *X86FI = - TailCall.getParent()->getParent()->getInfo<X86MachineFunctionInfo>(); + const X86MachineFunctionInfo *X86FI = MF->getInfo<X86MachineFunctionInfo>(); if (X86FI->getTCReturnAddrDelta() != 0 || TailCall.getOperand(1).getImm() != 0) { // A conditional tail call cannot do any stack adjustment. |