[llvm] r304365 - Check hasPersonalityFn before calling getPersonalityFn

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed May 31 15:21:20 PDT 2017


Author: rnk
Date: Wed May 31 17:21:20 2017
New Revision: 304365

URL: http://llvm.org/viewvc/llvm-project?rev=304365&view=rev
Log:
Check hasPersonalityFn before calling getPersonalityFn

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=304365&r1=304364&r2=304365&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed May 31 17:21:20 2017
@@ -954,11 +954,12 @@ static bool needFuncLabelsForEHOrDebugIn
   if (!MF.getLandingPads().empty() || MF.hasEHFunclets() || MMI->hasDebugInfo())
     return true;
 
-  // We might emit an LSDA anyway if we have an EH personality.
-  const Constant *PerFn = MF.getFunction()->getPersonalityFn();
-  if (!PerFn)
+  // We might emit an EH table that uses function begin and end labels even if
+  // we don't have any landingpads.
+  if (!MF.getFunction()->hasPersonalityFn())
     return false;
-  return !isNoOpWithoutInvoke(classifyEHPersonality(PerFn));
+  return !isNoOpWithoutInvoke(
+      classifyEHPersonality(MF.getFunction()->getPersonalityFn()));
 }
 
 /// EmitFunctionBody - This method emits the body and trailer for a




More information about the llvm-commits mailing list