[llvm] [memprof] Add an assert to InstrProfWriter::addMemProfData (PR #117426)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 24 21:07:57 PST 2024


================
@@ -351,9 +351,14 @@ bool InstrProfWriter::addMemProfCallStack(
 
 bool InstrProfWriter::addMemProfData(memprof::IndexedMemProfData Incoming,
                                      function_ref<void(Error)> Warn) {
-  // TODO: Once we remove support for MemProf format Version V1, assert that
-  // the three components (frames, call stacks, and records) are either all
-  // empty or populated.
+  // Return immediately if everything is empty.
----------------
kazutakahirata wrote:

> Do we ever try to add an empty memprof profile in practice?

No.  At least, llvm tests pass with without this `if` statement, meaning that we always supply all three components in the tests.  The `if` statement is there so that it won't trip on the new `assert`.

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


More information about the llvm-commits mailing list