Add null checks before using a pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272359 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Richard Trieu 2016-06-10 01:42:05 +00:00
parent 7f8e1c60de
commit fc34cc4521

View File

@ -84,9 +84,13 @@ bool ProfileSummaryInfo::isHotFunction(const Function *F) {
// example, no profile data is available).
bool ProfileSummaryInfo::isColdFunction(const Function *F) {
computeSummary();
if (!F)
return false;
if (F->hasFnAttribute(Attribute::Cold)) {
return true;
}
if (!Summary)
return false;
auto FunctionCount = F->getEntryCount();
// FIXME: The heuristic used below for determining coldness is based on
// preliminary SPEC tuning for inliner. This will eventually be a