Refactored the profitability analysis out of the IC promotion pass and
into lib/Analysis so that it can be accessed by the summary index
builder in a follow-on patch to enable IC promotion in ThinLTO (D21932).
Details
- Reviewers
xur davidxl - Commits
- rG3f4219865214: Refactor indirect call promotion profitability analysis (NFC)
rG1e44b5d3abc7: Refactor indirect call promotion profitability analysis (NFC)
rL275705: Refactor indirect call promotion profitability analysis (NFC)
rL275216: Refactor indirect call promotion profitability analysis (NFC)
Diff Detail
Event Timeline
Added missing new header file to patch:
include/llvm/Analysis/IndirectCallPromotionAnalysis.h
include/llvm/Analysis/IndirectCallPromotionAnalysis.h | ||
---|---|---|
61 | This analysis does not check legality, why is that? | |
lib/Transforms/Instrumentation/IndirectCallPromotion.cpp | ||
149 | Document the parameters including the new one. | |
262 | I think there is a bug in the original code. This check should be moved after legality check below. The update of NumOfPGOICallPromotion should also be done here instead of in tryToPromote. But this can be fixed in a different patch. |
lib/Transforms/Instrumentation/IndirectCallPromotion.cpp | ||
---|---|---|
262 | Which check are you referring to? | |
595 | is the last argument correct? I think it should be NumCandidates. |
include/llvm/Analysis/IndirectCallPromotionAnalysis.h | ||
---|---|---|
61 | I guess this can be a super set of the real transformations. this just to add edges. | |
lib/Analysis/IndirectCallPromotionAnalysis.cpp | ||
70 | icp-call-only and -icp-invoke-only are mainly for debug. I think it's better to keep together with the transformation code. |
include/llvm/Analysis/IndirectCallPromotionAnalysis.h | ||
---|---|---|
61 | Because the legality check is based on the target function, and this is being refactored so that it can be called when the target function is not yet known (when building the summary in the ThinLTO compile step where it is an inter-module indirect call). |
include/llvm/Analysis/IndirectCallPromotionAnalysis.h | ||
---|---|---|
61 |
Right | |
lib/Analysis/IndirectCallPromotionAnalysis.cpp | ||
70 | Why not have them here and prevent adding the ThinLTO edges in the debug case? | |
lib/Transforms/Instrumentation/IndirectCallPromotion.cpp | ||
149 | Ok | |
595 | Yes I think you are right, let me fix that. |
I am testing the fixed patch, should upload it shortly.
lib/Analysis/IndirectCallPromotionAnalysis.cpp | ||
---|---|---|
70 | Actually, after discussing with Rong, I have moved these back. |
This analysis does not check legality, why is that?