From b6dfdd2b1ecc84c77ea4eec3713caa07a1cab198 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sun, 8 Dec 2024 11:34:29 -0800 Subject: [PATCH] [memprof] Drop memprof:: in unit tests (NFC) (#119113) This patch replaces memprof::Foo with Foo if we have corresponding: using llvm::memprof::Foo; --- llvm/unittests/ProfileData/InstrProfTest.cpp | 4 +- llvm/unittests/ProfileData/MemProfTest.cpp | 56 +++++++++----------- 2 files changed, 28 insertions(+), 32 deletions(-) diff --git a/llvm/unittests/ProfileData/InstrProfTest.cpp b/llvm/unittests/ProfileData/InstrProfTest.cpp index 6df2ec1efcd81c..ac872d8235622b 100644 --- a/llvm/unittests/ProfileData/InstrProfTest.cpp +++ b/llvm/unittests/ProfileData/InstrProfTest.cpp @@ -393,7 +393,7 @@ IndexedMemProfRecord makeRecordV2(std::initializer_list<::llvm::memprof::CallStackId> AllocFrames, std::initializer_list<::llvm::memprof::CallStackId> CallSiteFrames, const MemInfoBlock &Block, const memprof::MemProfSchema &Schema) { - llvm::memprof::IndexedMemProfRecord MR; + IndexedMemProfRecord MR; for (const auto &CSId : AllocFrames) MR.AllocSites.emplace_back(CSId, Block, Schema); for (const auto &CSId : CallSiteFrames) @@ -533,7 +533,7 @@ TEST_F(InstrProfTest, test_caller_callee_pairs) { /*AllocFrames=*/{0x111, 0x222}, /*CallSiteFrames=*/{}, MIB, memprof::getHotColdSchema()); - memprof::IndexedMemProfData MemProfData; + IndexedMemProfData MemProfData; MemProfData.Frames.try_emplace(0, 0x123, 1, 2, false); MemProfData.Frames.try_emplace(1, 0x234, 3, 4, true); MemProfData.Frames.try_emplace(2, 0x123, 5, 6, false); diff --git a/llvm/unittests/ProfileData/MemProfTest.cpp b/llvm/unittests/ProfileData/MemProfTest.cpp index 55feb1c3f60b45..4edd5d449072cf 100644 --- a/llvm/unittests/ProfileData/MemProfTest.cpp +++ b/llvm/unittests/ProfileData/MemProfTest.cpp @@ -277,9 +277,9 @@ TEST(MemProf, RecordSerializationRoundTripVerion2) { /*dealloc_timestamp=*/2000, /*alloc_cpu=*/3, /*dealloc_cpu=*/4, /*Histogram=*/0, /*HistogramSize=*/0); - llvm::SmallVector CallStackIds = {0x123, 0x456}; + llvm::SmallVector CallStackIds = {0x123, 0x456}; - llvm::SmallVector CallSiteIds = {0x333, 0x444}; + llvm::SmallVector CallSiteIds = {0x333, 0x444}; IndexedMemProfRecord Record; for (const auto &CSId : CallStackIds) { @@ -308,9 +308,9 @@ TEST(MemProf, RecordSerializationRoundTripVersion2HotColdSchema) { Info.TotalLifetime = 33; Info.TotalLifetimeAccessDensity = 44; - llvm::SmallVector CallStackIds = {0x123, 0x456}; + llvm::SmallVector CallStackIds = {0x123, 0x456}; - llvm::SmallVector CallSiteIds = {0x333, 0x444}; + llvm::SmallVector CallSiteIds = {0x333, 0x444}; IndexedMemProfRecord Record; for (const auto &CSId : CallStackIds) { @@ -422,7 +422,7 @@ TEST(MemProf, SymbolizationFilter) { } TEST(MemProf, BaseMemProfReader) { - llvm::memprof::IndexedMemProfData MemProfData; + IndexedMemProfData MemProfData; Frame F1(/*Hash=*/IndexedMemProfRecord::getGUID("foo"), /*LineOffset=*/20, /*Column=*/5, /*IsInlineFrame=*/true); Frame F2(/*Hash=*/IndexedMemProfRecord::getGUID("bar"), /*LineOffset=*/10, @@ -455,7 +455,7 @@ TEST(MemProf, BaseMemProfReader) { } TEST(MemProf, BaseMemProfReaderWithCSIdMap) { - llvm::memprof::IndexedMemProfData MemProfData; + IndexedMemProfData MemProfData; Frame F1(/*Hash=*/IndexedMemProfRecord::getGUID("foo"), /*LineOffset=*/20, /*Column=*/5, /*IsInlineFrame=*/true); Frame F2(/*Hash=*/IndexedMemProfRecord::getGUID("bar"), /*LineOffset=*/10, @@ -553,8 +553,8 @@ MemInfoBlock makePartialMIB() { TEST(MemProf, MissingCallStackId) { // Use a non-existent CallStackId to trigger a mapping error in // toMemProfRecord. - llvm::memprof::IndexedAllocationInfo AI(0xdeadbeefU, makePartialMIB(), - llvm::memprof::getHotColdSchema()); + IndexedAllocationInfo AI(0xdeadbeefU, makePartialMIB(), + llvm::memprof::getHotColdSchema()); IndexedMemProfRecord IndexedMR; IndexedMR.AllocSites.push_back(AI); @@ -575,8 +575,8 @@ TEST(MemProf, MissingCallStackId) { } TEST(MemProf, MissingFrameId) { - llvm::memprof::IndexedAllocationInfo AI(0x222, makePartialMIB(), - llvm::memprof::getHotColdSchema()); + IndexedAllocationInfo AI(0x222, makePartialMIB(), + llvm::memprof::getHotColdSchema()); IndexedMemProfRecord IndexedMR; IndexedMR.AllocSites.push_back(AI); @@ -602,9 +602,8 @@ TEST(MemProf, MissingFrameId) { TEST(MemProf, RadixTreeBuilderEmpty) { llvm::DenseMap MemProfFrameIndexes; llvm::MapVector> MemProfCallStackData; - llvm::DenseMap - FrameHistogram = - llvm::memprof::computeFrameHistogram(MemProfCallStackData); + llvm::DenseMap FrameHistogram = + llvm::memprof::computeFrameHistogram(MemProfCallStackData); llvm::memprof::CallStackRadixTreeBuilder Builder; Builder.build(std::move(MemProfCallStackData), &MemProfFrameIndexes, FrameHistogram); @@ -617,12 +616,11 @@ TEST(MemProf, RadixTreeBuilderEmpty) { TEST(MemProf, RadixTreeBuilderOne) { llvm::DenseMap MemProfFrameIndexes = { {11, 1}, {12, 2}, {13, 3}}; - llvm::SmallVector CS1 = {13, 12, 11}; + llvm::SmallVector CS1 = {13, 12, 11}; llvm::MapVector> MemProfCallStackData; MemProfCallStackData.insert({hashCallStack(CS1), CS1}); - llvm::DenseMap - FrameHistogram = - llvm::memprof::computeFrameHistogram(MemProfCallStackData); + llvm::DenseMap FrameHistogram = + llvm::memprof::computeFrameHistogram(MemProfCallStackData); llvm::memprof::CallStackRadixTreeBuilder Builder; Builder.build(std::move(MemProfCallStackData), &MemProfFrameIndexes, FrameHistogram); @@ -640,14 +638,13 @@ TEST(MemProf, RadixTreeBuilderOne) { TEST(MemProf, RadixTreeBuilderTwo) { llvm::DenseMap MemProfFrameIndexes = { {11, 1}, {12, 2}, {13, 3}}; - llvm::SmallVector CS1 = {12, 11}; - llvm::SmallVector CS2 = {13, 12, 11}; + llvm::SmallVector CS1 = {12, 11}; + llvm::SmallVector CS2 = {13, 12, 11}; llvm::MapVector> MemProfCallStackData; MemProfCallStackData.insert({hashCallStack(CS1), CS1}); MemProfCallStackData.insert({hashCallStack(CS2), CS2}); - llvm::DenseMap - FrameHistogram = - llvm::memprof::computeFrameHistogram(MemProfCallStackData); + llvm::DenseMap FrameHistogram = + llvm::memprof::computeFrameHistogram(MemProfCallStackData); llvm::memprof::CallStackRadixTreeBuilder Builder; Builder.build(std::move(MemProfCallStackData), &MemProfFrameIndexes, FrameHistogram); @@ -670,18 +667,17 @@ TEST(MemProf, RadixTreeBuilderSuccessiveJumps) { llvm::DenseMap MemProfFrameIndexes = { {11, 1}, {12, 2}, {13, 3}, {14, 4}, {15, 5}, {16, 6}, {17, 7}, {18, 8}, }; - llvm::SmallVector CS1 = {14, 13, 12, 11}; - llvm::SmallVector CS2 = {15, 13, 12, 11}; - llvm::SmallVector CS3 = {17, 16, 12, 11}; - llvm::SmallVector CS4 = {18, 16, 12, 11}; + llvm::SmallVector CS1 = {14, 13, 12, 11}; + llvm::SmallVector CS2 = {15, 13, 12, 11}; + llvm::SmallVector CS3 = {17, 16, 12, 11}; + llvm::SmallVector CS4 = {18, 16, 12, 11}; llvm::MapVector> MemProfCallStackData; MemProfCallStackData.insert({hashCallStack(CS1), CS1}); MemProfCallStackData.insert({hashCallStack(CS2), CS2}); MemProfCallStackData.insert({hashCallStack(CS3), CS3}); MemProfCallStackData.insert({hashCallStack(CS4), CS4}); - llvm::DenseMap - FrameHistogram = - llvm::memprof::computeFrameHistogram(MemProfCallStackData); + llvm::DenseMap FrameHistogram = + llvm::memprof::computeFrameHistogram(MemProfCallStackData); llvm::memprof::CallStackRadixTreeBuilder Builder; Builder.build(std::move(MemProfCallStackData), &MemProfFrameIndexes, FrameHistogram); @@ -737,7 +733,7 @@ TEST(MemProf, YAMLParser) { llvm::memprof::YAMLMemProfReader YAMLReader; YAMLReader.parse(YAMLData); - llvm::memprof::IndexedMemProfData MemProfData = YAMLReader.takeMemProfData(); + IndexedMemProfData MemProfData = YAMLReader.takeMemProfData(); Frame F1(0x100, 11, 10, true); Frame F2(0x200, 22, 20, false);