diff options
| author | 2017-01-24 08:32:59 +0000 | |
|---|---|---|
| committer | 2017-01-24 08:32:59 +0000 | |
| commit | 53d771aafdbe5b919f264f53cba3788e2c4cffd2 (patch) | |
| tree | 7eca39498be0ff1e3a6daf583cd9ca5886bb2636 /gnu/llvm/unittests/ProfileData/InstrProfTest.cpp | |
| parent | In preparation of compiling our kernels with -ffreestanding, explicitly map (diff) | |
| download | wireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.tar.xz wireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.zip | |
Import LLVM 4.0.0 rc1 including clang and lld to help the current
development effort on OpenBSD/arm64.
Diffstat (limited to 'gnu/llvm/unittests/ProfileData/InstrProfTest.cpp')
| -rw-r--r-- | gnu/llvm/unittests/ProfileData/InstrProfTest.cpp | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/gnu/llvm/unittests/ProfileData/InstrProfTest.cpp b/gnu/llvm/unittests/ProfileData/InstrProfTest.cpp index c13f31251de..1b44463cd65 100644 --- a/gnu/llvm/unittests/ProfileData/InstrProfTest.cpp +++ b/gnu/llvm/unittests/ProfileData/InstrProfTest.cpp @@ -167,15 +167,13 @@ TEST_F(InstrProfTest, get_profile_summary) { auto Predicate = [&Cutoff](const ProfileSummaryEntry &PE) { return PE.Cutoff == Cutoff; }; - auto EightyPerc = std::find_if(Details.begin(), Details.end(), Predicate); + auto EightyPerc = find_if(Details, Predicate); Cutoff = 900000; - auto NinetyPerc = std::find_if(Details.begin(), Details.end(), Predicate); + auto NinetyPerc = find_if(Details, Predicate); Cutoff = 950000; - auto NinetyFivePerc = - std::find_if(Details.begin(), Details.end(), Predicate); + auto NinetyFivePerc = find_if(Details, Predicate); Cutoff = 990000; - auto NinetyNinePerc = - std::find_if(Details.begin(), Details.end(), Predicate); + auto NinetyNinePerc = find_if(Details, Predicate); ASSERT_EQ(576460752303423488U, EightyPerc->MinCount); ASSERT_EQ(288230376151711744U, NinetyPerc->MinCount); ASSERT_EQ(288230376151711744U, NinetyFivePerc->MinCount); @@ -204,6 +202,31 @@ TEST_F(InstrProfTest, get_profile_summary) { delete PSFromMD; } +TEST_F(InstrProfTest, test_writer_merge) { + InstrProfRecord Record1("func1", 0x1234, {42}); + NoError(Writer.addRecord(std::move(Record1))); + + InstrProfWriter Writer2; + InstrProfRecord Record2("func2", 0x1234, {0, 0}); + NoError(Writer2.addRecord(std::move(Record2))); + + NoError(Writer.mergeRecordsFromWriter(std::move(Writer2))); + + auto Profile = Writer.writeBuffer(); + readProfile(std::move(Profile)); + + Expected<InstrProfRecord> R = Reader->getInstrProfRecord("func1", 0x1234); + ASSERT_TRUE(NoError(R.takeError())); + ASSERT_EQ(1U, R->Counts.size()); + ASSERT_EQ(42U, R->Counts[0]); + + R = Reader->getInstrProfRecord("func2", 0x1234); + ASSERT_TRUE(NoError(R.takeError())); + ASSERT_EQ(2U, R->Counts.size()); + ASSERT_EQ(0U, R->Counts[0]); + ASSERT_EQ(0U, R->Counts[1]); +} + static const char callee1[] = "callee1"; static const char callee2[] = "callee2"; static const char callee3[] = "callee3"; |
