[PATCH] D152758: [NFC] Refactor MBB hotness/coldness into templated PSI functions
Han Shen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 13 22:40:20 PDT 2023
shenhan marked 3 inline comments as done.
shenhan added inline comments.
================
Comment at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:136
+ // MachineFuction). Similar to isFunctionColdInCallGraph.
+ if constexpr (std::is_same<FunctionType, Function>::value) {
+ if (hasSampleProfile()) {
----------------
wenlei wrote:
> This is better down through template specialization. Check how `SampleProfileInference<BT>::findUnlikelyJumps` handles Invoke in IR.
>
> You can extract only this part into a small helper, and specialize that helper based on template type (i.e. check call/invoke for IR, no-op for MIR)
Done.
================
Comment at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:171
+ if constexpr (std::is_same<FunctionType, Function>::value) {
+ if (hasSampleProfile()) {
+ uint64_t TotalCallCount = 0;
----------------
davidxl wrote:
> Can this part share code with the Hot checking counter part?
Done by extracting part of this into templated function "findTotalCallCount", leaving hot/cold checking part unchanged. This keeps code simple and also easy to understand.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152758/new/
https://reviews.llvm.org/D152758
More information about the llvm-commits
mailing list