[PATCH] D93254: [NFC][SampleFDO] Preparation to support multiple sections with the same type in ExtBinary format.

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 15 23:19:37 PST 2020


hoy added inline comments.


================
Comment at: llvm/include/llvm/ProfileData/SampleProfWriter.h:249
+    // current section.
+    uint32_t LayoutIndex;
+  };
----------------
Can this be made a field of `SecHdrTableEntry`?


================
Comment at: llvm/lib/ProfileData/SampleProfWriter.cpp:250
     const StringMap<FunctionSamples> &ProfileMap) {
-  if (auto EC = writeOneSection(SecProfSummary, ProfileMap))
+  if (auto EC = writeOneSection(SecProfSummary, 0, ProfileMap))
     return EC;
----------------
wmi wrote:
> hoy wrote:
> > How are the constant indices determined? I'm wondering if it's possible to automatically assign indices to avoid collision.
> The indice order should match the order in the SampleProfileWriterExtBinary::SectionHdrLayout. I find the indice order in the patch is not up-to-date. I will update the patch.
> 
> 
> 
I'm wondering what writing multiple same-typed sections will look like in future. Will `writeOneSection` take extra arguments? I'm thinking if we could still have a helper like `getEntryInLayout` to automatically retrieve layout index which may be helpful to adding new sections.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93254/new/

https://reviews.llvm.org/D93254



More information about the llvm-commits mailing list