[PATCH] D69384: Add unlikely attribute to outlined function

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 15:14:18 PDT 2019


tejohnson added a comment.

In D69384#1720538 <https://reviews.llvm.org/D69384#1720538>, @hiraditya wrote:

> btw, I had this patch in mind:
>
>   diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
>   index 5edc696c29a..60726320cf1 100644
>   --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
>   +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
>   @@ -434,11 +434,11 @@ bool CodeGenPrepare::runOnFunction(Function &F) {
>      ProfileSummaryInfo *PSI =
>          &getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI();
>   
>  
>   +  if (!PSI->hasProfileSummary()) {
>   +    auto EC = F.getEntryCount();
>   +     if (EC.hasValue() && (F.getEntryCount().getCount() == 0))
>   +      F.setSectionPrefix(".unlikely");
>   +  }
>   +  }
>


If we have an entry count then presumably we have profile data, so this shouldn't be needed. I was thinking the Cold attribute, that gets added in the splitting cold regardless of whether there is profile data.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69384/new/

https://reviews.llvm.org/D69384





More information about the llvm-commits mailing list