summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86WinEHState.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-09-16 17:19:44 +0000
committerReid Kleckner <rnk@google.com>2015-09-16 17:19:44 +0000
commit84ebff4a5eb2b96c71c70890157ebb2f514f5fad (patch)
tree51367f7df5c9fd1ac2f93c35a263a2f771bdb8ed /llvm/lib/Target/X86/X86WinEHState.cpp
parent6f6f137e497fb979da20519fc9dce437d8e75ab0 (diff)
downloadbcm5719-llvm-84ebff4a5eb2b96c71c70890157ebb2f514f5fad.tar.gz
bcm5719-llvm-84ebff4a5eb2b96c71c70890157ebb2f514f5fad.zip
[WinEH] Skip state numbering when no EH pads are present
Otherwise we'd try to emit the thunk that passes the LSDA to __CxxFrameHandler3. We don't emit the LSDA if there were no landingpads, so we'd end up with an assembler error when trying to write the COFF object. llvm-svn: 247820
Diffstat (limited to 'llvm/lib/Target/X86/X86WinEHState.cpp')
-rw-r--r--llvm/lib/Target/X86/X86WinEHState.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86WinEHState.cpp b/llvm/lib/Target/X86/X86WinEHState.cpp
index 38dc5db3430..d1206ec0ee0 100644
--- a/llvm/lib/Target/X86/X86WinEHState.cpp
+++ b/llvm/lib/Target/X86/X86WinEHState.cpp
@@ -167,6 +167,20 @@ bool WinEHStatePass::runOnFunction(Function &F) {
if (!isMSVCEHPersonality(Personality))
return false;
+ // Skip this function if there are no EH pads and we aren't using IR-level
+ // outlining.
+ if (WinEHParentName.empty()) {
+ bool HasPads = false;
+ for (BasicBlock &BB : F) {
+ if (BB.isEHPad()) {
+ HasPads = true;
+ break;
+ }
+ }
+ if (!HasPads)
+ return false;
+ }
+
// Disable frame pointer elimination in this function.
// FIXME: Do the nested handlers need to keep the parent ebp in ebp, or can we
// use an arbitrary register?
OpenPOWER on IntegriCloud