1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

CodeGen: Fix null dereference before null check

This commit is contained in:
Matt Arsenault 2021-05-10 20:56:24 -04:00
parent f3383e948b
commit 7612bae7b7

View File

@ -233,14 +233,20 @@ MachineBlockFrequencyInfo::getBlockFreq(const MachineBasicBlock *MBB) const {
Optional<uint64_t> MachineBlockFrequencyInfo::getBlockProfileCount( Optional<uint64_t> MachineBlockFrequencyInfo::getBlockProfileCount(
const MachineBasicBlock *MBB) const { const MachineBasicBlock *MBB) const {
if (!MBFI)
return None;
const Function &F = MBFI->getFunction()->getFunction(); const Function &F = MBFI->getFunction()->getFunction();
return MBFI ? MBFI->getBlockProfileCount(F, MBB) : None; return MBFI->getBlockProfileCount(F, MBB);
} }
Optional<uint64_t> Optional<uint64_t>
MachineBlockFrequencyInfo::getProfileCountFromFreq(uint64_t Freq) const { MachineBlockFrequencyInfo::getProfileCountFromFreq(uint64_t Freq) const {
if (!MBFI)
return None;
const Function &F = MBFI->getFunction()->getFunction(); const Function &F = MBFI->getFunction()->getFunction();
return MBFI ? MBFI->getProfileCountFromFreq(F, Freq) : None; return MBFI->getProfileCountFromFreq(F, Freq);
} }
bool MachineBlockFrequencyInfo::isIrrLoopHeader( bool MachineBlockFrequencyInfo::isIrrLoopHeader(