[PATCH] D152758: [NFC] Refactor MBB hotness/coldness into templated PSI functions

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 14 16:26:05 PDT 2023


wenlei added inline comments.


================
Comment at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:277
+  template <typename FunctionType>
+  std::optional<uint64_t> findTotalCallCount(const FunctionType *F) const {
+    if (!hasSampleProfile())
----------------
Call and Invoke are specific to IR version, so checking that in generic implementation is a bit weird. I'd suggest let generic implementation return `std::nullopt`, and have IR version check on Call and Invoke. 


================
Comment at: llvm/include/llvm/Analysis/ProfileSummaryInfo.h:277
+  template <typename FunctionType>
+  std::optional<uint64_t> findTotalCallCount(const FunctionType *F) const {
+    if (!hasSampleProfile())
----------------
wenlei wrote:
> Call and Invoke are specific to IR version, so checking that in generic implementation is a bit weird. I'd suggest let generic implementation return `std::nullopt`, and have IR version check on Call and Invoke. 
also nit: `findTotalCallCount`->`getTotalCallCount` to be consistent with `getProfileCount`.


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