[PGO] Function section hotness prefix should look at all blocks
authorTeresa Johnson <tejohnson@google.com>
Wed, 20 Dec 2017 17:53:10 +0000 (17:53 +0000)
committerTeresa Johnson <tejohnson@google.com>
Wed, 20 Dec 2017 17:53:10 +0000 (17:53 +0000)
commita4ce3bfdda9d0b4a864a7a19537efaaa19ebda72
treee3b5d1e44d1e09d89492145f82e8de4650b3dd77
parent2e5c71eadcee051d312e0d5ebda4e78adf153a47
[PGO] Function section hotness prefix should look at all blocks

Summary:
The function section prefix for PGO based layout (e.g. hot/unlikely)
should look at the hotness of all blocks not just the entry BB.
A function with a cold entry but a very hot loop should be placed in the
hot section, for example, so that it is located close to other hot
functions it may call. For SamplePGO it was already looking at the
branch weights on calls, and I made that code conditional on whether
this is SamplePGO since it was essentially a noop for instrumentation
PGO anyway.

Reviewers: davidxl

Subscribers: eraman, llvm-commits

Differential Revision: https://reviews.llvm.org/D41395

llvm-svn: 321197
llvm/include/llvm/Analysis/ProfileSummaryInfo.h
llvm/lib/Analysis/ProfileSummaryInfo.cpp
llvm/lib/CodeGen/CodeGenPrepare.cpp
llvm/test/Transforms/CodeGenPrepare/section.ll