From fc34cc4521783ee042e30d788d5464dd286f7c64 Mon Sep 17 00:00:00 2001 From: Richard Trieu Date: Fri, 10 Jun 2016 01:42:05 +0000 Subject: [PATCH] Add null checks before using a pointer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272359 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/ProfileSummaryInfo.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Analysis/ProfileSummaryInfo.cpp b/lib/Analysis/ProfileSummaryInfo.cpp index f3dc8b48732..7397073a06d 100644 --- a/lib/Analysis/ProfileSummaryInfo.cpp +++ b/lib/Analysis/ProfileSummaryInfo.cpp @@ -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