diff options
author | Teresa Johnson <tejohnson@google.com> | 2022-05-04 11:52:47 -0700 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2022-05-04 13:02:30 -0700 |
commit | 655294866cf8fa719b240a7e9fe51de9a2c48ddc (patch) | |
tree | a233edb465c6754218f9553d40b6a2f4d27535bf /llvm/unittests/ProfileData/InstrProfTest.cpp | |
parent | 6123e9c0d03bf1e3f43c3851f4122a7267b33c28 (diff) | |
download | llvm-655294866cf8fa719b240a7e9fe51de9a2c48ddc.zip llvm-655294866cf8fa719b240a7e9fe51de9a2c48ddc.tar.gz llvm-655294866cf8fa719b240a7e9fe51de9a2c48ddc.tar.bz2 |
[memprof] Use unknown_function error type for missing functions
Switch the error type when a function is not found in the memprof
profile to unknown_function. This gives compatibility with normal PGO
function matching, and also prevents issuing large numbers of additional
matching errors since pgo-warn-missing-function is off by default.
Differential Revision: https://reviews.llvm.org/D124953
Diffstat (limited to 'llvm/unittests/ProfileData/InstrProfTest.cpp')
-rw-r--r-- | llvm/unittests/ProfileData/InstrProfTest.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/unittests/ProfileData/InstrProfTest.cpp b/llvm/unittests/ProfileData/InstrProfTest.cpp index e40bc82..e097b37 100644 --- a/llvm/unittests/ProfileData/InstrProfTest.cpp +++ b/llvm/unittests/ProfileData/InstrProfTest.cpp @@ -352,8 +352,15 @@ TEST_F(InstrProfTest, test_memprof_getrecord_error) { auto Profile = Writer.writeBuffer(); readProfile(std::move(Profile)); + // Missing frames give a hash_mismatch error. auto RecordOr = Reader->getMemProfRecord(0x9999); - EXPECT_THAT_ERROR(RecordOr.takeError(), Failed()); + ASSERT_TRUE( + ErrorEquals(instrprof_error::hash_mismatch, RecordOr.takeError())); + + // Missing functions give a unknown_function error. + RecordOr = Reader->getMemProfRecord(0x1111); + ASSERT_TRUE( + ErrorEquals(instrprof_error::unknown_function, RecordOr.takeError())); } TEST_F(InstrProfTest, test_memprof_merge) { |