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

Han Shen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 15:40:16 PDT 2023


shenhan created this revision.
shenhan added reviewers: aidengrossman, xur, wenlei.
Herald added a subscriber: hiraditya.
Herald added a project: All.
shenhan requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The origin CL D152758 <https://reviews.llvm.org/D152758> caused gcc-12 build failures, which is caused by a gcc bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85282>, and won't be fixed in version 12.

The workaround here is to move full specialization function definitions out of class declaration into namespace level.

Tested with linux gcc-12, linux clang, windows cl compilers.

I've also uploaded 2 patches, the first one is the original D152758 <https://reviews.llvm.org/D152758> , then the fix, so they can be diff-ed clearly.

Below is origin CL description.
===============================

[NFC] Refactor MBB hotness/coldness into templated PSI functions.

In D152399 <https://reviews.llvm.org/D152399>, we calculate BPI->BFI in MachineFunctionSplit pass just to
use PSI->isFunctionHotInCallGraph, which is expensive. Instead, we can
implement this directly with MBFI.

Reviewer mentioned in the comment, that machine_size_opts already has
isFunctionColdInCallGraph, isFunctionHotInCallGraphNthPercentile, etc
implemented. These can be refactored and reused across MFS and machine
size opts.

This CL does this - it refactors out those internal static functions
into PSI as templated functions, so they can be accessed easily.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153927

Files:
  llvm/include/llvm/Analysis/ProfileSummaryInfo.h
  llvm/include/llvm/Transforms/Utils/SizeOpts.h
  llvm/lib/Analysis/ProfileSummaryInfo.cpp
  llvm/lib/CodeGen/MachineSizeOpts.cpp
  llvm/lib/Transforms/Utils/SizeOpts.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153927.535159.patch
Type: text/x-patch
Size: 31231 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230627/dee88037/attachment.bin>


More information about the llvm-commits mailing list