diff options
author | Wei Mi <wmi@google.com> | 2018-03-07 16:45:33 +0000 |
---|---|---|
committer | Wei Mi <wmi@google.com> | 2018-03-07 16:45:33 +0000 |
commit | 984ab0f1e66d247d7073323d28b1f9d5676af983 (patch) | |
tree | a2f7048c5fb686ed67d2cf151fd95f4b245b24bb /llvm/unittests/ProfileData | |
parent | 0d03d0588d5bebf370dea06f203f184503eed097 (diff) | |
download | bcm5719-llvm-984ab0f1e66d247d7073323d28b1f9d5676af983.tar.gz bcm5719-llvm-984ab0f1e66d247d7073323d28b1f9d5676af983.zip |
[SampleFDO] Extend SampleProfReader to handle demangled names.
SampleProfReader assumes function names in the profile are all mangled names.
However, there are cases that few demangled names are somehow contained in
the profile (usually because of debug info problems), which may trigger parsing
error in SampleProfReader and cause the whole profile to be unusable. The patch
extends SampleProfReader to handle profiles with demangled names, so that those
profiles can still be useful.
Differential revision: https://reviews.llvm.org/D44161
llvm-svn: 326905
Diffstat (limited to 'llvm/unittests/ProfileData')
-rw-r--r-- | llvm/unittests/ProfileData/SampleProfTest.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/unittests/ProfileData/SampleProfTest.cpp b/llvm/unittests/ProfileData/SampleProfTest.cpp index 764bded2f03..412f36f5c9c 100644 --- a/llvm/unittests/ProfileData/SampleProfTest.cpp +++ b/llvm/unittests/ProfileData/SampleProfTest.cpp @@ -77,6 +77,9 @@ struct SampleProfTest : ::testing::Test { BarSamples.addTotalSamples(20301); BarSamples.addHeadSamples(1437); BarSamples.addBodySamples(1, 0, 1437); + BarSamples.addCalledTargetSamples(1, 0, "_M_construct<char *>", 1000); + BarSamples.addCalledTargetSamples( + 1, 0, "string_view<std::allocator<char> >", 437); StringMap<FunctionSamples> Profiles; Profiles[FooName] = std::move(FooSamples); @@ -104,6 +107,11 @@ struct SampleProfTest : ::testing::Test { FunctionSamples &ReadBarSamples = ReadProfiles[BarName]; ASSERT_EQ(20301u, ReadBarSamples.getTotalSamples()); ASSERT_EQ(1437u, ReadBarSamples.getHeadSamples()); + ErrorOr<SampleRecord::CallTargetMap> CTMap = + ReadBarSamples.findCallTargetMapAt(1, 0); + ASSERT_FALSE(CTMap.getError()); + ASSERT_EQ(1000u, CTMap.get()["_M_construct<char *>"]); + ASSERT_EQ(437u, CTMap.get()["string_view<std::allocator<char> >"]); auto VerifySummary = [](ProfileSummary &Summary) mutable { ASSERT_EQ(ProfileSummary::PSK_Sample, Summary.getKind()); |