Check hasPersonalityFn before calling getPersonalityFn

llvm-svn: 304365
This commit is contained in:
Reid Kleckner 2017-05-31 22:21:20 +00:00
parent 1c3b0afbbe
commit 57ac61e005
1 changed files with 5 additions and 4 deletions

View File

@ -954,11 +954,12 @@ static bool needFuncLabelsForEHOrDebugInfo(const MachineFunction &MF,
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