]> granicus.if.org Git - llvm/commitdiff
Add null checks before using a pointer.
authorRichard Trieu <rtrieu@google.com>
Fri, 10 Jun 2016 01:42:05 +0000 (01:42 +0000)
committerRichard Trieu <rtrieu@google.com>
Fri, 10 Jun 2016 01:42:05 +0000 (01:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272359 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ProfileSummaryInfo.cpp

index f3dc8b487327ea26bb3f0a1112284b3725b3e202..7397073a06dc649b5b5ddf73c93bb93a504015ff 100644 (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