summaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineSizeOpts.cpp
AgeCommit message (Collapse)Author
2024-10-28Check hasOptSize() in shouldOptimizeForSize() (#112626)Ellis Hoag
2023-06-28[Analysis] Refactor MBB hotness/coldness into templated PSI functions.Han Shen
Currently, to use PSI->isFunctionHotInCallGraph, we first need to calculate BPI->BFI, which is expensive. Instead, we can implement this directly with MBFI. Also as @wenlei mentioned in another patch review, that MachineSizeOpts already has isFunctionColdInCallGraph, isFunctionHotInCallGraphNthPercentile, etc implemented. These can be refactored and so they can be reused across MachineFunctionSplitting and MachineSizeOpts passes. This CL does this - it refactors out those internal static functions into PSI as templated functions, so they can be accessed easily. Differential Revision: https://reviews.llvm.org/D153927
2023-06-28Revert D153927 "Resubmit with fix: [NFC] Refactor MBB hotness/coldness into ↵Fangrui Song
templated PSI functions." This reverts commit 4d8cf2ae6804e0d3f2b668dbec0f5c1983358328. There is a library layering violation. LLVMAnalysis cannot depend on LLVMCodeGen. ``` llvm/include/llvm/Analysis/ProfileSummaryInfo.h:19:10: fatal error: 'llvm/CodeGen/MachineFunction.h' file not found 19 | #include "llvm/CodeGen/MachineFunction.h" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```
2023-06-27Resubmit with fix: [NFC] Refactor MBB hotness/coldness into templated PSI ↵Han Shen
functions. In 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. Differential Revision: https://reviews.llvm.org/D153927
2023-06-27Revert "[NFC] Refactor MBB hotness/coldness into templated PSI functions."Aiden Grossman
This reverts commit c3e33720403c010e140c17313eeefd9a0f25887a. This has broken quite a few buildbots.
2023-06-26[NFC] Refactor MBB hotness/coldness into templated PSI functions.Han Shen
In 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. Differential Revision: https://reviews.llvm.org/D152758
2021-11-14[NFC] Use Optional<ProfileCount> to model invalid countsMircea Trofin
ProfileCount could model invalid values, but a user had no indication that the getCount method could return bogus data. Optional<ProfileCount> addresses that, because the user must dereference the optional. In addition, the patch removes concept duplication. Differential Revision: https://reviews.llvm.org/D113839
2020-07-24Revert rG5dd566b7c7b78bd- "PassManager.h - remove unnecessary ↵Simon Pilgrim
Function.h/Module.h includes. NFCI." This reverts commit 5dd566b7c7b78bd385418c72d63c79895be9ae97. Causing some buildbot failures that I'm not seeing on MSVC builds.
2020-07-24PassManager.h - remove unnecessary Function.h/Module.h includes. NFCI.Simon Pilgrim
PassManager.h is one of the top headers in the ClangBuildAnalyzer frontend worst offenders list. This exposes a large number of implicit dependencies on various forward declarations/includes in other headers that need addressing.
2020-03-05[PGO][PGSO] Use IsColdXNthPercentile for sample PGO.Hiroshi Yamauchi
Summary: This performs better for sample PGO. NFC as PGSOColdCodeOnlyForSamplePGO is still true. Reviewers: davidxl Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D75550
2020-02-17Hide implementation details. NFC>Benjamin Kramer
2020-01-31[PGO][PGSO] Handle MBFIWrapperHiroshi Yamauchi
Some code gen passes use MBFIWrapper to keep track of the frequency of new blocks. This was not taken into account and could lead to incorrect frequencies as MBFI silently returns zero frequency for unknown/new blocks. Add a variant for MBFIWrapper in the PGSO query interface. Depends on D73494.
2019-12-02[PGO][PGSO] Add an optional query type parameter to shouldOptimizeForSize.Hiroshi Yamauchi
Summary: In case of a need to distinguish different query sites for gradual commit or debugging of PGSO. NFC. Reviewers: davidxl Subscribers: hiraditya, zzheng, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70510
2019-10-28[PGO][PGSO] SizeOpts changes.Hiroshi Yamauchi
Summary: (Split of off D67120) SizeOpts/MachineSizeOpts changes for profile guided size optimization. (A second try after previously committed as r375254 and reverted as r375375.) Subscribers: mgorny, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69409
2019-10-20Reverted r375254 as it has broken some build bots for a long time.Vladimir Vereschaka
llvm-svn: 375375
2019-10-18[PGO][PGSO] SizeOpts changes.Hiroshi Yamauchi
Summary: (Split of off D67120) SizeOpts/MachineSizeOpts changes for profile guided size optimization. Reviewers: davidxl Subscribers: mgorny, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69070 llvm-svn: 375254