diff options
| author | Teresa Johnson <tejohnson@google.com> | 2017-05-11 23:18:05 +0000 |
|---|---|---|
| committer | Teresa Johnson <tejohnson@google.com> | 2017-05-11 23:18:05 +0000 |
| commit | 2a6b7991d4038e1a07b1627bfa2dd350d365fa9d (patch) | |
| tree | db00fa90d5fac10bf32f659bcc51cc3416041e2e /llvm/unittests | |
| parent | 5ab198958497cad183dbc8ad23907e04c27d5b2f (diff) | |
| download | bcm5719-llvm-2a6b7991d4038e1a07b1627bfa2dd350d365fa9d.tar.gz bcm5719-llvm-2a6b7991d4038e1a07b1627bfa2dd350d365fa9d.zip | |
Restrict call metadata based hotness detection to Sample PGO mode
Summary:
Don't use the metadata on call instructions for determining hotness
unless we are in sample PGO mode, where it is needed because profile
counts are not accurate. In instrumentation mode this is not necessary
and does more harm than good when calls have VP metadata that hasn't
been properly scaled after transformations or dropped after constant
prop based devirtualization (both should be fixed, but we don't need
to do this in the first place for instrumentation PGO).
This required adjusting a number of tests to distinguish between sample
and instrumentation PGO handling, and to add in profile summary metadata
so that getProfileCount can get the summary.
Reviewers: davidxl, danielcdh
Subscribers: aemerson, rengolin, mehdi_amini, Prazek, llvm-commits
Differential Revision: https://reviews.llvm.org/D32877
llvm-svn: 302844
Diffstat (limited to 'llvm/unittests')
| -rw-r--r-- | llvm/unittests/Analysis/ProfileSummaryInfoTest.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/unittests/Analysis/ProfileSummaryInfoTest.cpp b/llvm/unittests/Analysis/ProfileSummaryInfoTest.cpp index 0b4b1de2805..3454474f037 100644 --- a/llvm/unittests/Analysis/ProfileSummaryInfoTest.cpp +++ b/llvm/unittests/Analysis/ProfileSummaryInfoTest.cpp @@ -162,6 +162,12 @@ TEST_F(ProfileSummaryInfoTest, InstrProf) { EXPECT_TRUE(PSI.isHotCallSite(CS1, &BFI)); EXPECT_FALSE(PSI.isHotCallSite(CS2, &BFI)); + + // Test that adding an MD_prof metadata with a hot count on CS2 does not + // change its hotness as it has no effect in instrumented profiling. + MDBuilder MDB(M->getContext()); + CI2->setMetadata(llvm::LLVMContext::MD_prof, MDB.createBranchWeights({400})); + EXPECT_FALSE(PSI.isHotCallSite(CS2, &BFI)); } TEST_F(ProfileSummaryInfoTest, SampleProf) { |

