summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ProfileData
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2018-12-19 03:24:03 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2018-12-19 03:24:03 +0000
commit0b832095d7c383e464e51db0a7c86f9e553926ca (patch)
treed6d0c0cfd94f184d693283c84a99729ca512ded6 /llvm/unittests/ProfileData
parenta6247e7cf426431e869e947532ba3f0fb9f6e8fc (diff)
downloadbcm5719-llvm-0b832095d7c383e464e51db0a7c86f9e553926ca.tar.gz
bcm5719-llvm-0b832095d7c383e464e51db0a7c86f9e553926ca.zip
Fix use-after-free with profile remapping.
We need to keep the underlying profile reader alive as long as the profile data, because the profile data may contain StringRefs referring to strings in the reader's name table. llvm-svn: 349600
Diffstat (limited to 'llvm/unittests/ProfileData')
-rw-r--r--llvm/unittests/ProfileData/SampleProfTest.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/unittests/ProfileData/SampleProfTest.cpp b/llvm/unittests/ProfileData/SampleProfTest.cpp
index 67e6e9fc95b..a31eccefb4d 100644
--- a/llvm/unittests/ProfileData/SampleProfTest.cpp
+++ b/llvm/unittests/ProfileData/SampleProfTest.cpp
@@ -128,11 +128,15 @@ struct SampleProfTest : ::testing::Test {
FunctionSamples *ReadFooSamples = Reader->getSamplesFor(FooName);
ASSERT_TRUE(ReadFooSamples != nullptr);
+ if (Format != SampleProfileFormat::SPF_Compact_Binary)
+ ASSERT_EQ("_Z3fooi", ReadFooSamples->getName());
ASSERT_EQ(7711u, ReadFooSamples->getTotalSamples());
ASSERT_EQ(610u, ReadFooSamples->getHeadSamples());
FunctionSamples *ReadBarSamples = Reader->getSamplesFor(BarName);
ASSERT_TRUE(ReadBarSamples != nullptr);
+ if (Format != SampleProfileFormat::SPF_Compact_Binary)
+ ASSERT_EQ("_Z3bari", ReadBarSamples->getName());
ASSERT_EQ(20301u, ReadBarSamples->getTotalSamples());
ASSERT_EQ(1437u, ReadBarSamples->getHeadSamples());
ErrorOr<SampleRecord::CallTargetMap> CTMap =
OpenPOWER on IntegriCloud