This is the corresponding decoding change to D135912: [PseudoProbe] Replace relocation with offset for entry probe.. The change is downwards compatible as long as there's no mixed use of the old encoding and the new encoding.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
There are a couple more uses of std::*map<> left that could be converted to maps from LLVM's ADT.
Yes, std::map is used everywhere in llvm-profgen. Do you think ADT performs better than it? I can do a separate refactoring if you don't mind.
I had this diff in mind, but the refactoring sounds good too. ADT avoids malloc, more details at: https://llvm.org/docs/ProgrammersManual.html#map-like-containers-std-map-densemap-etc
I see. Looks like it's great for small keys and values. I'll go through the code base and adjust existing std::map usage (not only for the ones introduced here). Will make a separate change.
Actually let me change the std::unordered_map introduced by this change to DenseMap. The refactoring will likely to take a bit longer.
Sentinel probe case isn't covered for both encoding and decoding in any test cases, would be good to have some coverage.
llvm/lib/MC/MCPseudoProbe.cpp | ||
---|---|---|
419 | nit: Cur == &DummyInlineRoot -> IsTopLevelFunc | |
476 | Maybe I'm asking the same question as the one on previous patch, but why do we still have cases with absolute address encoded? I thought for main function body we have GUID -> symbol (reverse lookup) -> address; and we have similar way to get address for sentinel for split binary function. The rest should all be offset/delta. |
Forgot to mention that the updated binary, i.e, inline-cs-pseudoprobe.perfbin, is built with the new encoding. The binary supports a dozen llvm-profgen tests and they all pass with the current decoding changes.
llvm/lib/MC/MCPseudoProbe.cpp | ||
---|---|---|
419 | Done. | |
476 | This is mainly for downwards-compatibility, i.e. to have new llvm-profgen handle old binaries. |
Do we have a split function case in the existing tests? I thought we don't, but if we have, that'd be good enough.
llvm/lib/MC/MCPseudoProbe.cpp | ||
---|---|---|
476 | Ok, makes sense. Like I mentioned in the other patch, add a comment explaining this is for backward compatibility and a todo for removal? |
Good point. The test binary func-split.perfbin is updated.
llvm/lib/MC/MCPseudoProbe.cpp | ||
---|---|---|
476 | Done. |
lgtm, with a nit on naming.
llvm/lib/MC/MCPseudoProbe.cpp | ||
---|---|---|
470 | nit: binary function -> split function |