In SamplePGO ThinLTO compile phase, we will not invoke ICP as it may introduce confusion to the 2nd annotation. This patch extracted that logic and makes it clearer before profile annotation. In the mean time, we need to make function importing process both inlined callsites as well as not promoted indirect callsites.
Details
Diff Detail
- Build Status
Buildable 10714 Build 10714: arc lint + arc unit
Event Timeline
Is this patch NFC? It looks like there is some new handling for indirect call targets in findImportedFunctions that makes it non-NFC. Could you split this into an NFC refactoring patch and a separate non-NFC patch with the enhancements if so? I think that would be clearer and easier to review.
include/llvm/ProfileData/SampleProf.h | ||
---|---|---|
343 | Needs comment. | |
include/llvm/Transforms/SampleProfile.h | ||
29 | How about IsThinLTOPreLink for consistency with Phase? (Here and in other classes) | |
lib/Transforms/IPO/SampleProfile.cpp | ||
89 | Similar, let's use PreLink instead of Compile, to be consistent with terminology introduced for pass pipeline. After looking at how this is used, it does something different than what I originally thought. I first read this as whether to invoke this pass during the ThinLTO compile/pre-link, but it is actually forcing simulation of being in that phase. So maybe better to have something like "SampleProfileForceThinLTOPreLink" or similar. I see this is used when invoked via opt. Can the phase be forced instead by using "-passes='thinlto-pre-link<O2>" (see test/Other/new-pm-thinlto-defaults.ll)? |
include/llvm/ProfileData/SampleProf.h | ||
---|---|---|
344 | What is "FS"? Also, the sentence is unclear, partly because there is an "if" with no corresponding "then". Is this handling indirect or direct calls (CallTargets is not documented - could you add a doxygen description to it)? From the comments it sounds like this is looking for additional hot targets that we didn't import/inline in the profiled binary, but might want to now with additional profile data (?) | |
lib/Transforms/IPO/SampleProfile.cpp | ||
798 | Suggest reversing the sense of this condition and moving the shorter pre link case up here. |
Needs comment.