summaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
diff options
context:
space:
mode:
authorMingming Liu <mingmingl@google.com>2024-09-06 16:38:17 -0700
committerGitHub <noreply@github.com>2024-09-06 16:38:17 -0700
commitd4ddf06b0c7f38612f334db71ef1d7a58a3cc8e0 (patch)
treed2a2858eb6caa0fa9ae46e6cda80994bf92ee158 /llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
parent3a13c5a2862fdc957d751a7679581d5da151efc2 (diff)
[NFCI]Remove EntryCount from FunctionSummary and clean up surrounding synthetic count passes. (#107471)
The primary motivation is to remove `EntryCount` from `FunctionSummary`. This frees 8 bytes out of `sizeof(FunctionSummary)` (136 bytes as of https://github.com/llvm/llvm-project/commit/64498c54831bed9cf069e0923b9b73678c6451d8). While I'm at it, this PR clean up {SummaryBasedOptimizations, SyntheticCountsPropagation} since they were not used and there are no plans to further invest on them. With this patch, bitcode writer writes a placeholder 0 at the byte offset of `EntryCount` and bitcode reader can parse the function entry count at the correct byte offset. Added a TODO to stop writing `EntryCount` and bump bitcode version
Diffstat (limited to 'llvm/lib/Transforms/Utils/FunctionImportUtils.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/FunctionImportUtils.cpp18
1 files changed, 1 insertions, 17 deletions
diff --git a/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp b/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
index 87be6be01885..766c7501550d 100644
--- a/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
+++ b/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
@@ -220,24 +220,8 @@ FunctionImportGlobalProcessing::getLinkage(const GlobalValue *SGV,
void FunctionImportGlobalProcessing::processGlobalForThinLTO(GlobalValue &GV) {
ValueInfo VI;
- if (GV.hasName()) {
+ if (GV.hasName())
VI = ImportIndex.getValueInfo(GV.getGUID());
- // Set synthetic function entry counts.
- if (VI && ImportIndex.hasSyntheticEntryCounts()) {
- if (Function *F = dyn_cast<Function>(&GV)) {
- if (!F->isDeclaration()) {
- for (const auto &S : VI.getSummaryList()) {
- auto *FS = cast<FunctionSummary>(S->getBaseObject());
- if (FS->modulePath() == M.getModuleIdentifier()) {
- F->setEntryCount(Function::ProfileCount(FS->entryCount(),
- Function::PCT_Synthetic));
- break;
- }
- }
- }
- }
- }
- }
// We should always have a ValueInfo (i.e. GV in index) for definitions when
// we are exporting, and also when importing that value.