diff options
author | Reid Kleckner <reid@kleckner.net> | 2015-04-15 18:48:15 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2015-04-15 18:48:15 +0000 |
commit | 3e9fadfbc8b6d9969ea47cce9295bfdf3212d97f (patch) | |
tree | ac17f2a0fb6548eafd6e025c2ebce2567eac7d47 /llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp | |
parent | 9e7a8172a3f4f26062a9866aa874ff3b5776e49d (diff) | |
download | bcm5719-llvm-3e9fadfbc8b6d9969ea47cce9295bfdf3212d97f.tar.gz bcm5719-llvm-3e9fadfbc8b6d9969ea47cce9295bfdf3212d97f.zip |
[WinEH] Try to make the MachineFunction CFG more accurate
This avoids emitting code for unreachable landingpad blocks that contain
calls to llvm.eh.actions and indirectbr.
It's also a first step towards unifying the SEH and WinEH lowering
codepaths. I'm keeping the old fan-in lowering of SEH around until the
preparation version works well enough that we can switch over without
breaking existing users.
llvm-svn: 235037
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp b/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp index 0d422d83e2d..f89d36455f4 100644 --- a/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp @@ -108,8 +108,13 @@ void Win64Exception::endFunction(const MachineFunction *MF) { if (!shouldEmitPersonality && !shouldEmitMoves) return; - // Map all labels and get rid of any dead landing pads. - MMI->TidyLandingPads(); + EHPersonality Per = MMI->getPersonalityType(); + + // Get rid of any dead landing pads if we're not using a Windows EH scheme. In + // Windows EH schemes, the landing pad is not actually reachable. It only + // exists so that we can emit the right table data. + if (!isMSVCEHPersonality(Per)) + MMI->TidyLandingPads(); if (shouldEmitPersonality) { Asm->OutStreamer.PushSection(); @@ -119,7 +124,6 @@ void Win64Exception::endFunction(const MachineFunction *MF) { // Emit the tables appropriate to the personality function in use. If we // don't recognize the personality, assume it uses an Itanium-style LSDA. - EHPersonality Per = MMI->getPersonalityType(); if (Per == EHPersonality::MSVC_Win64SEH) emitCSpecificHandlerTable(); else if (Per == EHPersonality::MSVC_CXX) |