summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86ExpandPseudo.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-11-13 21:27:00 +0000
committerReid Kleckner <rnk@google.com>2015-11-13 21:27:00 +0000
commit75b4be9a1198c53384980eadca2708628b97622c (patch)
treef12c5cb7442b9338145c652f46a5bfdfcec4d201 /llvm/lib/Target/X86/X86ExpandPseudo.cpp
parent447bbdb17134e9463e45d41610b9e0dd73323dcf (diff)
downloadbcm5719-llvm-75b4be9a1198c53384980eadca2708628b97622c.tar.gz
bcm5719-llvm-75b4be9a1198c53384980eadca2708628b97622c.zip
[WinEH] Fix ESP management with 32-bit __CxxFrameHandler3
The C++ EH personality automatically restores ESP from the C++ EH registration node after a catchret. I mistakenly thought it was like SEH, which does not restore ESP. It makes sense for C++ EH to differ from SEH here because SEH does not use funclets for catches, and does not allow catching inside of finally. C++ EH may need to unwind through multiple catch funclets and eventually catchret to some outer funclet. Therefore, the runtime has to keep track of which ESP to use with catchret, rather than having the compiler reload it manually. llvm-svn: 253084
Diffstat (limited to 'llvm/lib/Target/X86/X86ExpandPseudo.cpp')
-rw-r--r--llvm/lib/Target/X86/X86ExpandPseudo.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86ExpandPseudo.cpp b/llvm/lib/Target/X86/X86ExpandPseudo.cpp
index 9e5a51c4da1..6015d3465de 100644
--- a/llvm/lib/Target/X86/X86ExpandPseudo.cpp
+++ b/llvm/lib/Target/X86/X86ExpandPseudo.cpp
@@ -19,6 +19,7 @@
#include "X86InstrInfo.h"
#include "X86MachineFunctionInfo.h"
#include "X86Subtarget.h"
+#include "llvm/Analysis/LibCallSemantics.h"
#include "llvm/CodeGen/Passes.h" // For IDs of passes that are preserved.
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
@@ -144,7 +145,9 @@ bool X86ExpandPseudo::ExpandMI(MachineBasicBlock &MBB,
case X86::EH_RESTORE: {
// Restore ESP and EBP, and optionally ESI if required.
- X86FL->restoreWin32EHStackPointers(MBB, MBBI, DL, /*RestoreSP=*/true);
+ bool IsSEH = isAsynchronousEHPersonality(classifyEHPersonality(
+ MBB.getParent()->getFunction()->getPersonalityFn()));
+ X86FL->restoreWin32EHStackPointers(MBB, MBBI, DL, /*RestoreSP=*/IsSEH);
MBBI->eraseFromParent();
return true;
}
OpenPOWER on IntegriCloud