[llvm] 0a1f7f0 - [ctxprof][nfc] Drop `Section` in `writeFlatSection` (#130654)

via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 10 12:50:45 PDT 2025


Author: Mircea Trofin
Date: 2025-03-10T12:50:41-07:00
New Revision: 0a1f7f0e661b48dc4470d31d95e22e95a7959adc

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

LOG: [ctxprof][nfc] Drop `Section` in `writeFlatSection` (#130654)

It matches `writeContextual`, and also, it's not the whole section that's being written there, just a profile, piecemeal.

Added: 
    

Modified: 
    llvm/include/llvm/ProfileData/PGOCtxProfWriter.h
    llvm/lib/ProfileData/PGOCtxProfWriter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ProfileData/PGOCtxProfWriter.h b/llvm/include/llvm/ProfileData/PGOCtxProfWriter.h
index 82cf787153cd9..40f355f99eb53 100644
--- a/llvm/include/llvm/ProfileData/PGOCtxProfWriter.h
+++ b/llvm/include/llvm/ProfileData/PGOCtxProfWriter.h
@@ -88,8 +88,8 @@ class PGOCtxProfileWriter final : public ctx_profile::ProfileWriter {
   void endContextSection() override;
 
   void startFlatSection();
-  void writeFlatSection(ctx_profile::GUID Guid, const uint64_t *Buffer,
-                        size_t BufferSize);
+  void writeFlat(ctx_profile::GUID Guid, const uint64_t *Buffer,
+                 size_t BufferSize);
   void endFlatSection();
 
   // constants used in writing which a reader may find useful.

diff  --git a/llvm/lib/ProfileData/PGOCtxProfWriter.cpp b/llvm/lib/ProfileData/PGOCtxProfWriter.cpp
index d099572fc152a..e906836b16b2b 100644
--- a/llvm/lib/ProfileData/PGOCtxProfWriter.cpp
+++ b/llvm/lib/ProfileData/PGOCtxProfWriter.cpp
@@ -126,9 +126,8 @@ void PGOCtxProfileWriter::writeContextual(const ContextNode &RootNode) {
   writeImpl(std::nullopt, RootNode);
 }
 
-void PGOCtxProfileWriter::writeFlatSection(ctx_profile::GUID Guid,
-                                           const uint64_t *Buffer,
-                                           size_t Size) {
+void PGOCtxProfileWriter::writeFlat(ctx_profile::GUID Guid,
+                                    const uint64_t *Buffer, size_t Size) {
   Writer.EnterSubblock(PGOCtxProfileBlockIDs::FlatProfileBlockID, CodeLen);
   writeGuid(Guid);
   writeCounters({Buffer, Size});
@@ -240,7 +239,7 @@ Error llvm::createCtxProfFromYAML(StringRef Profile, raw_ostream &Out) {
   if (!SPR.FlatProfiles.empty()) {
     Writer.startFlatSection();
     for (const auto &[Guid, Counters] : SPR.FlatProfiles)
-      Writer.writeFlatSection(Guid, Counters.data(), Counters.size());
+      Writer.writeFlat(Guid, Counters.data(), Counters.size());
     Writer.endFlatSection();
   }
   if (EC)


        


More information about the llvm-commits mailing list