[PATCH] D96981: [SampleFDO][NFC] Refactor: make SampleProfileLoaderBaseImpl a template class

Rong Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 16:21:20 PST 2021


xur added a comment.

In D96981#2572663 <https://reviews.llvm.org/D96981#2572663>, @dblaikie wrote:

> Really really broad feedback - this work to write common abstractions over LLVM IR and MIR seems to overlap with https://lists.llvm.org/pipermail/llvm-dev/2020-December/147433.html
>
> It's non-trivial as to what exactly these APIs should look like (virtual/type erased v templates, etc). But may be useful to consider some of the options here.
>
> My current rough guess is that templates are probably the right tool, but that more common abstractions should be implemented in the IR types themselves - eg: the TypeMap and getFunction/getEntryBB could be rolled into the IR types themselves as authoritative/core features, rather than grafting them on with traits.

David. Thanks for the comments!

Yes. If all the building blocks have a common obstructions, we probably can use other method to share the common transformation / analysis code b/w IR and MIR.
This template base method has been used in the code base (such as BlockFreqInfo, Dominator and DominatorFrontier). 
For now, I think I will use the template base method as I have some other patches depending on this.

Once the common abstractions are in-place. I don't mind to refactor the code again if that is a better way for sharing the code.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96981/new/

https://reviews.llvm.org/D96981



More information about the llvm-commits mailing list