summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ProfileData
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2019-07-09 22:01:04 +0000
committerVedant Kumar <vsk@apple.com>2019-07-09 22:01:04 +0000
commitd6c15b661ab0aabb00f1219ce4af7136938e67e2 (patch)
treecc48137fd7130aab91a868714905e43f960d1bbd /llvm/unittests/ProfileData
parentc5f8aa8bea66f85e392b22b3d393ac0653c06cee (diff)
downloadbcm5719-llvm-d6c15b661ab0aabb00f1219ce4af7136938e67e2.tar.gz
bcm5719-llvm-d6c15b661ab0aabb00f1219ce4af7136938e67e2.zip
[Profile] Support raw/indexed profiles larger than 4GB
rdar://45955976 llvm-svn: 365565
Diffstat (limited to 'llvm/unittests/ProfileData')
-rw-r--r--llvm/unittests/ProfileData/InstrProfTest.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/unittests/ProfileData/InstrProfTest.cpp b/llvm/unittests/ProfileData/InstrProfTest.cpp
index 174e8deabb5..b1e515984a4 100644
--- a/llvm/unittests/ProfileData/InstrProfTest.cpp
+++ b/llvm/unittests/ProfileData/InstrProfTest.cpp
@@ -1044,4 +1044,25 @@ TEST_F(SparseInstrProfTest, preserve_no_records) {
INSTANTIATE_TEST_CASE_P(MaybeSparse, MaybeSparseInstrProfTest,
::testing::Bool(),);
+#if defined(_LP64) && defined(EXPENSIVE_CHECKS)
+TEST(ProfileReaderTest, ReadsLargeFiles) {
+ const size_t LargeSize = 1ULL << 32; // 4GB
+
+ auto RawProfile = WritableMemoryBuffer::getNewUninitMemBuffer(LargeSize);
+ if (!RawProfile)
+ return;
+ auto RawProfileReaderOrErr = InstrProfReader::create(std::move(RawProfile));
+ ASSERT_TRUE(InstrProfError::take(RawProfileReaderOrErr.takeError()) ==
+ instrprof_error::unrecognized_format);
+
+ auto IndexedProfile = WritableMemoryBuffer::getNewUninitMemBuffer(LargeSize);
+ if (!IndexedProfile)
+ return;
+ auto IndexedReaderOrErr =
+ IndexedInstrProfReader::create(std::move(IndexedProfile), nullptr);
+ ASSERT_TRUE(InstrProfError::take(IndexedReaderOrErr.takeError()) ==
+ instrprof_error::bad_magic);
+}
+#endif
+
} // end anonymous namespace
OpenPOWER on IntegriCloud