diff --git a/lib/CodeGen/MachineBlockFrequencyInfo.cpp b/lib/CodeGen/MachineBlockFrequencyInfo.cpp index 0368583fa23..c569f035036 100644 --- a/lib/CodeGen/MachineBlockFrequencyInfo.cpp +++ b/lib/CodeGen/MachineBlockFrequencyInfo.cpp @@ -233,14 +233,20 @@ MachineBlockFrequencyInfo::getBlockFreq(const MachineBasicBlock *MBB) const { Optional MachineBlockFrequencyInfo::getBlockProfileCount( const MachineBasicBlock *MBB) const { + if (!MBFI) + return None; + const Function &F = MBFI->getFunction()->getFunction(); - return MBFI ? MBFI->getBlockProfileCount(F, MBB) : None; + return MBFI->getBlockProfileCount(F, MBB); } Optional MachineBlockFrequencyInfo::getProfileCountFromFreq(uint64_t Freq) const { + if (!MBFI) + return None; + const Function &F = MBFI->getFunction()->getFunction(); - return MBFI ? MBFI->getProfileCountFromFreq(F, Freq) : None; + return MBFI->getProfileCountFromFreq(F, Freq); } bool MachineBlockFrequencyInfo::isIrrLoopHeader(