summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2016-06-10 01:42:05 +0000
committerRichard Trieu <rtrieu@google.com>2016-06-10 01:42:05 +0000
commitfae70b6f2b46ef17f14e687e6c4839bef3330d2f (patch)
tree2ff7ccea495e6b175a79664b8c14649131ae4214 /llvm/lib/Analysis
parent6a88ba6f3424aa8a6bcd59853317bf6ae49565f9 (diff)
downloadbcm5719-llvm-fae70b6f2b46ef17f14e687e6c4839bef3330d2f.tar.gz
bcm5719-llvm-fae70b6f2b46ef17f14e687e6c4839bef3330d2f.zip
Add null checks before using a pointer.
llvm-svn: 272359
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/ProfileSummaryInfo.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ProfileSummaryInfo.cpp b/llvm/lib/Analysis/ProfileSummaryInfo.cpp
index f3dc8b48732..7397073a06d 100644
--- a/llvm/lib/Analysis/ProfileSummaryInfo.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud