[compiler-rt] [llvm] [InstrFDO]Allow indexed profile reader to parse compatible future versions and returns errors for incompatible ones. (PR #88212)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 13:29:31 PDT 2024


================
@@ -78,6 +78,24 @@ class InstrProfWriter {
   // Whether to serialize the full schema.
   bool MemProfFullSchema;
 
+  // Returns the profile version in uint32_t, which should be used as the
+  // the lowest 32 bits in Header.Version.
+  uint32_t profileVersion() const;
+
+  // Returns the minimum profile reader version required to parse this profile.
+  uint64_t minCompatibleReaderVersion() const;
+
+  // The following fields are used by unit tests only.
+  // If not std::nullopt, this field overwrites the lowest 32 bits of
+  // Header::Version in the generated profile.
+  std::optional<uint32_t> ProfileVersion = std::nullopt;
----------------
kazutakahirata wrote:

`std::optional` is default constructed as `std::nullopt`.

```suggestion
  std::optional<uint32_t> ProfileVersion;
```

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


More information about the llvm-commits mailing list