[PATCH] D152758: [NFC] Refactor MBB hotness/coldness into MBFI.

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 21:50:57 PDT 2023


davidxl 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)
Agree.  If we plan to have this for MBFI in the future, we can just extract this part out as a helper function too.


================
Comment at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:171
+    if constexpr (std::is_same<FunctionType, Function>::value) {
+      if (hasSampleProfile()) {
+        uint64_t TotalCallCount = 0;
----------------
Can this part share code with the Hot checking counter part?


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