[PATCH] D95832: [SampleFDO][NFC] Refacrot SampleProfileLoad to reuse the code in MachineIR

Rong Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 6 13:53:56 PST 2021


xur updated this revision to Diff 321963.
xur retitled this revision from "[SampleFDO][NFC] Add inline keywords to member functions that will be in the template header file" to "[SampleFDO][NFC] Refacrot SampleProfileLoad to reuse the code in MachineIR".
xur edited the summary of this revision.
xur added a comment.

Here is the another way to refactor the SampleProfileLoader:

I tried Wei's idea of putting all the function bodies into a cpp file and explicit instantiate for IR and MachineIR.
That idea did not work: I place a new cpp file into llvm/lib/ProfileData. But that creates a circular dependency b/w ProfileData and CodeGen.
Current implementation in sample loader requires  a complete definition of machine IR classes.
It might be possible to break the dependency by rewriting some of the code. But that would be too many changes. The benefit does not justify the cost -- we still have duplicated object for IR and MachineIR and we just combine them into one object.


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

https://reviews.llvm.org/D95832

Files:
  llvm/lib/Transforms/IPO/SampleProfile.cpp
  llvm/test/Transforms/SampleProfile/inline-coverage.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95832.321963.patch
Type: text/x-patch
Size: 30235 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210206/2204c4e2/attachment.bin>


More information about the llvm-commits mailing list