[llvm] Introduction of Composite Profile section in ExtBinary format (PR #166553)

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 09:51:59 PDT 2026


================
@@ -490,6 +558,111 @@ TEST_F(SampleProfTest, roundtrip_ext_binary_profile) {
   testRoundTrip(SampleProfileFormat::SPF_Ext_Binary, false, false);
 }
 
+// Verify the full ExtBinary round trip through composite profile sections.
+TEST_F(SampleProfTest, roundtrip_composite_ext_binary_profile) {
+  [[maybe_unused]] ScopedCompositeProfile Composite(true);
----------------
snehasish wrote:

Could we avoid the ScopedCompositeProfile helper and expose this as a writer setter instead?

SampleProfileWriter already has several configuration setters following this pattern, e.g. setUseMD5(), setUseCtxSplitLayout(), setUseMD5ProfileSymbolList(), setUseMD5IndexedTables(), and setFormatVersion(). Composite output seems like the same kind of writer configuration.

Something like setUseCompositeProfile(bool) would let the unit tests configure the writer directly instead of reaching into the global command-line option registry, resetting the option, calling addOccurrence(), and restoring it with a test-only RAII wrapper.

The command-line option could configure the writer through the same setter during creation. This would also make the composite-to-legacy reuse test more direct, since that test is really exercising reconfiguration of a single writer rather than behavior of the global command-line state.



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


More information about the llvm-commits mailing list