[llvm] [memprof] Introduce readMemProf (NFC) (PR #88095)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 9 10:26:48 PDT 2024


teresajohnson wrote:

> @teresajohnson I suggested this approach. I think it's simpler in the short term as we iterate quickly on new versions. I'm thinking about a case where we have 3-4 different versions which reuse the same logic with multiple conditions. I think it will be hard to reason about, error prone and difficult to remove. Once the format stabilizes we can refactor the implementation to keep the versions we care about. What do you think?

Since the only current difference is in the way RecordTableOffset is set, perhaps all of the common stuff can be refactored out and each version do something like:

```
readMemProfVx() {
   const uint64_t RecordTableOffset = (version specific setting);
   return readMemProfImpl();
}
```

I dislike having so much identical code because it becomes more difficult to reason about and update consistently.

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


More information about the llvm-commits mailing list