diff options
| author | Nathan Slingerland <slingn@gmail.com> | 2015-12-02 18:19:24 +0000 |
|---|---|---|
| committer | Nathan Slingerland <slingn@gmail.com> | 2015-12-02 18:19:24 +0000 |
| commit | aa5702d92b75427d9900703c0b4226f9bb24d1d4 (patch) | |
| tree | 1ed72cfb44966d882db475e8e51fb83d94cb253d /llvm/unittests | |
| parent | f520eff7827912ab1f9aa2dd08fcd2b0bfa4f945 (diff) | |
| download | bcm5719-llvm-aa5702d92b75427d9900703c0b4226f9bb24d1d4.tar.gz bcm5719-llvm-aa5702d92b75427d9900703c0b4226f9bb24d1d4.zip | |
[llvm-profdata] Change instr prof counter overflow to saturate rather than discard
Summary: This changes overflow handling during instrumentation profile merge. Rathar than throwing away records that would result in counter overflow, merged counts are instead clamped to the maximum representable value. A warning about counter overflow is still surfaced to the user as before.
Reviewers: dnovillo, davidxl, silvas
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D14893
llvm-svn: 254525
Diffstat (limited to 'llvm/unittests')
| -rw-r--r-- | llvm/unittests/ProfileData/InstrProfTest.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/unittests/ProfileData/InstrProfTest.cpp b/llvm/unittests/ProfileData/InstrProfTest.cpp index 2f3adb65a0e..635a5431a51 100644 --- a/llvm/unittests/ProfileData/InstrProfTest.cpp +++ b/llvm/unittests/ProfileData/InstrProfTest.cpp @@ -354,7 +354,7 @@ TEST_F(InstrProfTest, get_icall_data_merge1_saturation) { const uint64_t Max = std::numeric_limits<uint64_t>::max(); InstrProfRecord Record1("caller", 0x1234, {1}); - InstrProfRecord Record2("caller", 0x1234, {1}); + InstrProfRecord Record2("caller", 0x1234, {Max}); InstrProfRecord Record3("callee1", 0x1235, {3, 4}); Record1.reserveSites(IPVK_IndirectCallTarget, 1); @@ -375,6 +375,9 @@ TEST_F(InstrProfTest, get_icall_data_merge1_saturation) { // Verify saturation of counts. ErrorOr<InstrProfRecord> R = Reader->getInstrProfRecord("caller", 0x1234); ASSERT_TRUE(NoError(R.getError())); + + ASSERT_EQ(Max, R.get().Counts[0]); + ASSERT_EQ(1U, R.get().getNumValueSites(IPVK_IndirectCallTarget)); std::unique_ptr<InstrProfValueData[]> VD = R.get().getValueForSite(IPVK_IndirectCallTarget, 0); |

