[PATCH] D112465: [llvm-profgen] Avoid writing any data to CSNameTableSection for the empty CSNameTable

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 25 18:04:41 PDT 2021


wenlei added inline comments.


================
Comment at: llvm/lib/ProfileData/SampleProfWriter.cpp:255-256
 std::error_code SampleProfileWriterExtBinaryBase::writeCSNameTableSection() {
+  if (CSNameTable.empty())
+    return sampleprof_error::success;
+
----------------
`SampleProfileReaderExtBinaryBase::readCSNameTableSec` would still expect to read a zero here, and if we skip writing the zero, the read will get some garbage data? Or did I miss anything?

Also this is inconsistent with how we write other sections - we don't omit zero size.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112465



More information about the llvm-commits mailing list