[compiler-rt] [llvm] [InstrFDO]Allow indexed profile reader to parse compatible future versions and returns errors for incompatible ones. (PR #88212)
Snehasish Kumar via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 25 12:27:04 PDT 2024
================
@@ -710,9 +745,28 @@ Error InstrProfWriter::writeImpl(ProfOStream &OS) {
OS.write(0);
uint64_t VTableNamesOffset = OS.tell();
- if (!WritePrevVersion)
+ OS.write(0);
+
+ // Record the offset of 'Header::Size' field.
+ const uint64_t OnDiskHeaderSizeOffset = OS.tell();
+
+ if (!WritePrevVersion) {
+ // Reserve the space for `OnDiskByteSize` to allow back patching later.
+ OS.write(0);
+
+ // Write the minimum compatible version required.
+ OS.write(minProfileReaderVersion());
+ }
+
+ // This is a test-only path to append dummy header fields.
+ // NOTE: please write all other header fields before this one.
+ if (AppendAdditionalHeaderFields)
OS.write(0);
----------------
snehasish wrote:
cc: @kazutakahirata who also suggested a refactoring of the instrprof writer code. In general I think that's a good direction to breakdown the monolithic implementation which exists today.
https://github.com/llvm/llvm-project/pull/88212
More information about the llvm-commits
mailing list