[llvm] a742693 - [ctx_prof] Add missing test for `PGOContextualProfile::getContainedGuids`

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 13:41:41 PDT 2024


Author: Mircea Trofin
Date: 2024-07-17T13:40:16-07:00
New Revision: a742693f6104055ec026852a70a68275fb82f7a0

URL: https://github.com/llvm/llvm-project/commit/a742693f6104055ec026852a70a68275fb82f7a0
DIFF: https://github.com/llvm/llvm-project/commit/a742693f6104055ec026852a70a68275fb82f7a0.diff

LOG: [ctx_prof] Add missing test for `PGOContextualProfile::getContainedGuids`

Added: 
    

Modified: 
    llvm/unittests/ProfileData/PGOCtxProfReaderWriterTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/ProfileData/PGOCtxProfReaderWriterTest.cpp b/llvm/unittests/ProfileData/PGOCtxProfReaderWriterTest.cpp
index d2cdbb28e2fce..6c6798ded00b5 100644
--- a/llvm/unittests/ProfileData/PGOCtxProfReaderWriterTest.cpp
+++ b/llvm/unittests/ProfileData/PGOCtxProfReaderWriterTest.cpp
@@ -115,6 +115,15 @@ TEST_F(PGOCtxProfRWTest, RoundTrip) {
     EXPECT_EQ(Ctxes.size(), 2U);
     for (auto &[G, R] : roots())
       checkSame(*R, Ctxes.find(G)->second);
+
+    DenseSet<GlobalValue::GUID> Guids;
+    Ctxes.at(1U).getContainedGuids(Guids);
+    EXPECT_THAT(Guids,
+                testing::WhenSorted(testing::ElementsAre(1U, 2U, 4U, 5U)));
+
+    Guids.clear();
+    Ctxes.at(3U).getContainedGuids(Guids);
+    EXPECT_THAT(Guids, testing::ElementsAre(3U));
   }
 }
 


        


More information about the llvm-commits mailing list