[compiler-rt] [llvm] [TypeProf][InstrPGO] Introduce raw and instr profile format change for type profiling. (PR #81691)

David Li via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 16 09:42:25 PST 2024


================
@@ -455,12 +455,12 @@ Error InstrProfWriter::writeImpl(ProfOStream &OS) {
   Header.MemProfOffset = 0;
   Header.BinaryIdOffset = 0;
   Header.TemporalProfTracesOffset = 0;
+  Header.VTableNamesOffset = 0;
   int N = sizeof(IndexedInstrProf::Header) / sizeof(uint64_t);
 
-  // Only write out all the fields except 'HashOffset', 'MemProfOffset',
-  // 'BinaryIdOffset' and `TemporalProfTracesOffset`. We need to remember the
-  // offset of these fields to allow back patching later.
-  for (int I = 0; I < N - 4; I++)
+  // Only write out the first four fields. We need to remember the offset of the
+  // remaining fields to allow back patching later.
+  for (int I = 0; I < 4; I++)
----------------
david-xl wrote:

should be 4 -- hashoffset field need patch up.

My original review comments was to introduce a macro instead of using a constant literal. The original macro name i suggested is not great. Perhaps do this:

#define NUM_FIELDS_PATCHING 5

// only write up first fields that do not need patching
for (int I = 0; I < N - NUM_FIELDS_PATCHING; I++) {
   ...
}

https://github.com/llvm/llvm-project/pull/81691


More information about the llvm-commits mailing list