summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
diff options
context:
space:
mode:
authorKeno Fischer <kfischer@college.harvard.edu>2015-07-14 19:22:51 +0000
committerKeno Fischer <kfischer@college.harvard.edu>2015-07-14 19:22:51 +0000
commitaff703a2ca704a55eadf024497bc5914ed089372 (patch)
treec7b7ff39807894a23917ff6c8be033aa08742017 /llvm/lib/CodeGen/AsmPrinter/WinException.cpp
parentfea7765219c18743800785d8c58290695f661594 (diff)
downloadbcm5719-llvm-aff703a2ca704a55eadf024497bc5914ed089372.tar.gz
bcm5719-llvm-aff703a2ca704a55eadf024497bc5914ed089372.zip
[CodeGen] Force emission of personality directive if explicitly specified
Summary: Before this change, personality directives were not emitted if there was no invoke left in the function (of course until recently this also meant that we couldn't know what the personality actually was). This patch forces personality directives to still be emitted, unless it is known to be a noop in the absence of invokes, or the user explicitly specified `nounwind` (and not `uwtable`) on the function. Reviewers: majnemer, rnk Subscribers: rnk, llvm-commits Differential Revision: http://reviews.llvm.org/D10884 llvm-svn: 242185
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/WinException.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/WinException.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
index 7ef2832d41a..71c77815e28 100644
--- a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
@@ -74,8 +74,12 @@ void WinException::beginFunction(const MachineFunction *MF) {
if (F->hasPersonalityFn())
Per = dyn_cast<Function>(F->getPersonalityFn()->stripPointerCasts());
- shouldEmitPersonality = hasLandingPads &&
- PerEncoding != dwarf::DW_EH_PE_omit && Per;
+ bool forceEmitPersonality =
+ F->hasPersonalityFn() && !isNoOpWithoutInvoke(classifyEHPersonality(Per)) &&
+ F->needsUnwindTableEntry();
+
+ shouldEmitPersonality = forceEmitPersonality || (hasLandingPads &&
+ PerEncoding != dwarf::DW_EH_PE_omit && Per);
unsigned LSDAEncoding = TLOF.getLSDAEncoding();
shouldEmitLSDA = shouldEmitPersonality &&
OpenPOWER on IntegriCloud