summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86FrameLowering.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-11-16 18:47:25 +0000
committerReid Kleckner <rnk@google.com>2015-11-16 18:47:25 +0000
commitc397b26790871ea0be6fa7dfdd860c2584560e8f (patch)
treeffc26fac02511eae255c56e5825bfde9ab6073db /llvm/lib/Target/X86/X86FrameLowering.cpp
parent4255b04e7bfa3197fdae6b042b7ccbf8f86be061 (diff)
downloadbcm5719-llvm-c397b26790871ea0be6fa7dfdd860c2584560e8f.tar.gz
bcm5719-llvm-c397b26790871ea0be6fa7dfdd860c2584560e8f.zip
[WinEH] Don't let UnwindHelp alias the return address
On top of that, don't bother allocating and initializing UnwindHelp if we don't have any funclets. Currently we always use RBP as our frame pointer when funclets are present, so this change makes it impossible to come here without any fixed stack objects. Fixes PR25533. llvm-svn: 253245
Diffstat (limited to 'llvm/lib/Target/X86/X86FrameLowering.cpp')
-rw-r--r--llvm/lib/Target/X86/X86FrameLowering.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp
index 3c557fe8a11..72baa078661 100644
--- a/llvm/lib/Target/X86/X86FrameLowering.cpp
+++ b/llvm/lib/Target/X86/X86FrameLowering.cpp
@@ -2662,17 +2662,17 @@ void X86FrameLowering::processFunctionBeforeFrameFinalized(
// If this function isn't doing Win64-style C++ EH, we don't need to do
// anything.
const Function *Fn = MF.getFunction();
- if (!STI.is64Bit() || !Fn->hasPersonalityFn() ||
- classifyEHPersonality(MF.getFunction()->getPersonalityFn()) !=
- EHPersonality::MSVC_CXX)
+ if (!STI.is64Bit() || !MF.getMMI().hasEHFunclets() ||
+ classifyEHPersonality(Fn->getPersonalityFn()) != EHPersonality::MSVC_CXX)
return;
// Win64 C++ EH needs to allocate the UnwindHelp object at some fixed offset
// relative to RSP after the prologue. Find the offset of the last fixed
- // object, so that we can allocate a slot immediately following it. Fixed
- // objects have negative frame indices.
+ // object, so that we can allocate a slot immediately following it. If there
+ // were no fixed objects, use offset -SlotSize, which is immediately after the
+ // return address. Fixed objects have negative frame indices.
MachineFrameInfo *MFI = MF.getFrameInfo();
- int64_t MinFixedObjOffset = 0;
+ int64_t MinFixedObjOffset = -SlotSize;
for (int I = MFI->getObjectIndexBegin(); I < 0; ++I)
MinFixedObjOffset = std::min(MinFixedObjOffset, MFI->getObjectOffset(I));
OpenPOWER on IntegriCloud