[llvm] [MemProf] Add basic summary section support (PR #141805)
    Kazu Hirata via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed May 28 10:48:04 PDT 2025
    
    
  
================
@@ -3312,6 +3313,19 @@ static int showMemProfProfile(ShowFormat SFormat, raw_fd_ostream &OS) {
 
   auto Reader = std::move(ReaderOrErr.get());
   memprof::AllMemProfData Data = Reader->getAllMemProfData();
+
+  // For v4 and above the summary is serialized in the indexed profile, and can
+  // be accessed from the reader. Earlier versions build the summary below.
+  // The summary is emitted as YAML comments at the start of the output.
+  auto *MemProfSum = Reader->getMemProfSummary();
+  if (MemProfSum) {
----------------
kazutakahirata wrote:
nit: Combine like so:
```suggestion
  if (auto *MemProfSum = Reader->getMemProfSummary()) {
```
https://github.com/llvm/llvm-project/pull/141805
    
    
More information about the llvm-commits
mailing list