OSDN Git Service

[PGO] Fix handling of cold entry count for instrumented PGO
authorTeresa Johnson <tejohnson@google.com>
Mon, 18 Dec 2017 20:02:43 +0000 (20:02 +0000)
committerTeresa Johnson <tejohnson@google.com>
Mon, 18 Dec 2017 20:02:43 +0000 (20:02 +0000)
commit833c4754718c4f5326eda59926a8c06a271ebe76
tree3e2721c68894b4d6a90a1e0883f64bd7cde67815
parentd3fbd022be5a5aae1f6a8bbbded44c41ac231cce
[PGO] Fix handling of cold entry count for instrumented PGO

Summary:
In r277849, getEntryCount was changed to return None when the entry
count was 0, specifically for SamplePGO where it means no samples were
recorded. However, for instrumentation PGO a 0 entry count should be
returned directly, since it does mean that the function was completely
cold. Otherwise we end up treating these functions conservatively
in isFunctionEntryCold() and isColdBB().

Instead, for SamplePGO use -1 when there are no samples, and change
getEntryCount to return None when the value is -1.

Reviewers: danielcdh, davidxl

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321018 91177308-0d34-0410-b5e6-96231b3b80d8
lib/IR/Function.cpp
lib/Transforms/IPO/SampleProfile.cpp
test/Transforms/SampleProfile/entry_counts.ll