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

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 10 10:14:57 PDT 2016


Tested? (is this covered by an existing test, just was buggy in the
original commit & revealed by a buildbot (asan, etc)?)

On Thu, Jun 9, 2016 at 6:42 PM, Richard Trieu via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> 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
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160610/94758853/attachment.html>


More information about the llvm-commits mailing list