summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86FrameLowering.cpp
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2015-11-04 22:37:28 +0000
committerQuentin Colombet <qcolombet@apple.com>2015-11-04 22:37:28 +0000
commit421723cdd81bc94aec1adb96ee9d3b505fe6d3a9 (patch)
treee9e65eeac5088de08f66bebb3fdcf1bb2fdd1ef5 /llvm/lib/Target/X86/X86FrameLowering.cpp
parentffec81ca0095fc22a2544f3cd42320a80899c15d (diff)
downloadbcm5719-llvm-421723cdd81bc94aec1adb96ee9d3b505fe6d3a9.tar.gz
bcm5719-llvm-421723cdd81bc94aec1adb96ee9d3b505fe6d3a9.zip
[x86] Teach the shrink-wrapping hooks to do the proper thing with Win64.
Win64 has some strict requirements for the epilogue. As a result, we disable shrink-wrapping for Win64 unless the block that gets the epilogue is already an exit block. Fixes PR24193. llvm-svn: 252088
Diffstat (limited to 'llvm/lib/Target/X86/X86FrameLowering.cpp')
-rw-r--r--llvm/lib/Target/X86/X86FrameLowering.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp
index 7b7f0daf12b..ee866fa45c3 100644
--- a/llvm/lib/Target/X86/X86FrameLowering.cpp
+++ b/llvm/lib/Target/X86/X86FrameLowering.cpp
@@ -2184,6 +2184,14 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
bool X86FrameLowering::canUseAsEpilogue(const MachineBasicBlock &MBB) const {
assert(MBB.getParent() && "Block is not attached to a function!");
+ // Win64 has strict requirements in terms of epilogue and we are
+ // not taking a chance at messing with them.
+ // I.e., unless this block is already an exit block, we can't use
+ // it as an epilogue.
+ if (MBB.getParent()->getSubtarget<X86Subtarget>().isTargetWin64() &&
+ !MBB.succ_empty() && !MBB.isReturnBlock())
+ return false;
+
if (canUseLEAForSPInEpilogue(*MBB.getParent()))
return true;
OpenPOWER on IntegriCloud