From d4ddf06b0c7f38612f334db71ef1d7a58a3cc8e0 Mon Sep 17 00:00:00 2001 From: Mingming Liu Date: Fri, 6 Sep 2024 16:38:17 -0700 Subject: [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 --- llvm/lib/IR/ModuleSummaryIndex.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'llvm/lib/IR/ModuleSummaryIndex.cpp') diff --git a/llvm/lib/IR/ModuleSummaryIndex.cpp b/llvm/lib/IR/ModuleSummaryIndex.cpp index 6713d32..a788e63 100644 --- a/llvm/lib/IR/ModuleSummaryIndex.cpp +++ b/llvm/lib/IR/ModuleSummaryIndex.cpp @@ -91,12 +91,11 @@ constexpr uint64_t ModuleSummaryIndex::BitcodeSummaryVersion; uint64_t ModuleSummaryIndex::getFlags() const { uint64_t Flags = 0; + // Flags & 0x4 is reserved. DO NOT REUSE. if (withGlobalValueDeadStripping()) Flags |= 0x1; if (skipModuleByDistributedBackend()) Flags |= 0x2; - if (hasSyntheticEntryCounts()) - Flags |= 0x4; if (enableSplitLTOUnit()) Flags |= 0x8; if (partiallySplitLTOUnits()) @@ -124,10 +123,7 @@ void ModuleSummaryIndex::setFlags(uint64_t Flags) { // Set on combined index only. if (Flags & 0x2) setSkipModuleByDistributedBackend(); - // 1 bit: HasSyntheticEntryCounts flag. - // Set on combined index only. - if (Flags & 0x4) - setHasSyntheticEntryCounts(); + // Flags & 0x4 is reserved. DO NOT REUSE. // 1 bit: DisableSplitLTOUnit flag. // Set on per module indexes. It is up to the client to validate // the consistency of this flag across modules being linked. -- cgit v1.1