[llvm] r272359 - Add null checks before using a pointer.

Richard Trieu via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 9 18:42:05 PDT 2016


Author: rtrieu
Date: Thu Jun  9 20:42:05 2016
New Revision: 272359

URL: http://llvm.org/viewvc/llvm-project?rev=272359&view=rev
Log:
Add null checks before using a pointer.

Modified:
    llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp

Modified: llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp?rev=272359&r1=272358&r2=272359&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp Thu Jun  9 20:42:05 2016
@@ -84,9 +84,13 @@ bool ProfileSummaryInfo::isHotFunction(c
 // 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




More information about the llvm-commits mailing list