[PATCH] D152758: [NFC] Refactor MBB hotness/coldness into MBFI.
Wenlei He via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 13 19:58:46 PDT 2023
wenlei added a subscriber: davidxl.
wenlei added a comment.
+ at davidxl
================
Comment at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:136
+ // MachineFuction). Similar to isFunctionColdInCallGraph.
+ if constexpr (std::is_same<FunctionType, Function>::value) {
+ if (hasSampleProfile()) {
----------------
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)
================
Comment at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:170
+ // MachineSizeOpts.cpp.
+ if constexpr (std::is_same<FunctionType, Function>::value) {
+ if (hasSampleProfile()) {
----------------
same here
================
Comment at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:311
+ // MachineFuction). Similar to isFunctionColdInCallGraph.
+ if constexpr (std::is_same<FunctionType, Function>::value) {
+ if (hasSampleProfile()) {
----------------
same here
================
Comment at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:362
+ getEntryCount(const FunctionType *F) const {
+ if constexpr (std::is_same<FunctionType, MachineFunction>::value) {
+ return F->getFunction().getEntryCount();
----------------
same here
================
Comment at: llvm/lib/Analysis/ProfileSummaryInfo.cpp:98-100
-/// Returns true if the function's entry is hot. If it returns false, it
-/// either means it is not hot or it is unknown whether it is hot or not (for
-/// example, no profile data is available).
----------------
nit: this comment seem lost?
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