[llvm] Implements PGOBBAddrMap in Object and ObjectYAML with tests [1/5] (PR #71750)

Rahman Lavaee via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 15:31:22 PST 2023


rlavaee wrote:

> If we keep the two classes `PGOBBAddrMap` and `BBAddrMap`, I don't think that this would simplify the encoding/decoding logic that much. `PGOBBAddrMap` would be the same while `BBAddrMap` would either need to error if Feature is not zero or decode but ignore the extra data. I personally would lean towards having `BBAddrMap` ignore extra data since `PGO...` is a superset and I suspect ignoring could simplify 'trait design' complexity.

One way to do this is to have the decoding function return two structures `std::vector<BBAddrMap>` and `std::vector<PGOFrequencyMap>`. `PGOFrequencyMap` does not store any address information so we don't need to duplicate the base fields. The only drawback is that we need to define the mapping between the two data structures.

For decoding, we can inspect the feature field and populate `PGOFrequencyMap` if we need to. WDYT?


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


More information about the llvm-commits mailing list