summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ProfileData/CoverageMappingTest.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2016-03-28 01:16:12 +0000
committerVedant Kumar <vsk@apple.com>2016-03-28 01:16:12 +0000
commit141ed944920e969d6adc4135aa346315395614fd (patch)
tree4f2446c16f09ed40239d700a4268dc81d0735f5d /llvm/unittests/ProfileData/CoverageMappingTest.cpp
parent544e4f97b3ada9e3483477c5479044f7d7f8e4c0 (diff)
downloadbcm5719-llvm-141ed944920e969d6adc4135aa346315395614fd.tar.gz
bcm5719-llvm-141ed944920e969d6adc4135aa346315395614fd.zip
[Coverage] Fix the way we load "<unknown>:func" records
When emitting coverage mappings for functions with local linkage and an unknown filename, we use "<unknown>:func" for the PGO function name. The problem is that we don't strip "<unknown>" from the name when loading coverage data, like we do for other file names. Fix that and add a test. llvm-svn: 264559
Diffstat (limited to 'llvm/unittests/ProfileData/CoverageMappingTest.cpp')
-rw-r--r--llvm/unittests/ProfileData/CoverageMappingTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/unittests/ProfileData/CoverageMappingTest.cpp b/llvm/unittests/ProfileData/CoverageMappingTest.cpp
index c85da9a0f9c..7f80384c63a 100644
--- a/llvm/unittests/ProfileData/CoverageMappingTest.cpp
+++ b/llvm/unittests/ProfileData/CoverageMappingTest.cpp
@@ -304,6 +304,21 @@ TEST_P(MaybeSparseCoverageMappingTest, strip_filename_prefix) {
ASSERT_EQ("func", Names[0]);
}
+TEST_P(MaybeSparseCoverageMappingTest, strip_unknown_filename_prefix) {
+ InstrProfRecord Record("<unknown>:func", 0x1234, {0});
+ ProfileWriter.addRecord(std::move(Record));
+ readProfCounts();
+
+ addCMR(Counter::getCounter(0), "", 1, 1, 9, 9);
+ loadCoverageMapping("<unknown>:func", 0x1234);
+
+ std::vector<std::string> Names;
+ for (const auto &Func : LoadedCoverage->getCoveredFunctions())
+ Names.push_back(Func.Name);
+ ASSERT_EQ(1U, Names.size());
+ ASSERT_EQ("func", Names[0]);
+}
+
INSTANTIATE_TEST_CASE_P(MaybeSparse, MaybeSparseCoverageMappingTest,
::testing::Bool());
OpenPOWER on IntegriCloud