[clang] d4ddf06 - [NFCI]Remove EntryCount from FunctionSummary and clean up surrounding synthetic count passes. (#107471)

via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 6 16:38:20 PDT 2024


Author: Mingming Liu
Date: 2024-09-06T16:38:17-07:00
New Revision: d4ddf06b0c7f38612f334db71ef1d7a58a3cc8e0

URL: https://github.com/llvm/llvm-project/commit/d4ddf06b0c7f38612f334db71ef1d7a58a3cc8e0
DIFF: https://github.com/llvm/llvm-project/commit/d4ddf06b0c7f38612f334db71ef1d7a58a3cc8e0.diff

LOG: [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

Added: 
    

Modified: 
    clang/docs/tools/clang-formatted-files.txt
    llvm/include/llvm/IR/ModuleSummaryIndex.h
    llvm/include/llvm/IR/ModuleSummaryIndexYAML.h
    llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
    llvm/lib/AsmParser/LLParser.cpp
    llvm/lib/Bitcode/Reader/BitcodeReader.cpp
    llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
    llvm/lib/IR/ModuleSummaryIndex.cpp
    llvm/lib/LTO/CMakeLists.txt
    llvm/lib/LTO/LTO.cpp
    llvm/lib/LTO/ThinLTOCodeGenerator.cpp
    llvm/lib/Passes/PassBuilder.cpp
    llvm/lib/Passes/PassBuilderPipelines.cpp
    llvm/lib/Passes/PassRegistry.def
    llvm/lib/Transforms/IPO/CMakeLists.txt
    llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
    llvm/utils/gn/secondary/llvm/lib/LTO/BUILD.gn
    llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn

Removed: 
    llvm/include/llvm/LTO/SummaryBasedOptimizations.h
    llvm/include/llvm/Transforms/IPO/SyntheticCountsPropagation.h
    llvm/lib/LTO/SummaryBasedOptimizations.cpp
    llvm/lib/Transforms/IPO/SyntheticCountsPropagation.cpp
    llvm/test/Bitcode/thinlto-synthetic-count-flag.ll
    llvm/test/ThinLTO/X86/function_entry_count.ll
    llvm/test/Transforms/SyntheticCountsPropagation/initial.ll
    llvm/test/Transforms/SyntheticCountsPropagation/prop.ll
    llvm/test/Transforms/SyntheticCountsPropagation/scc.ll


################################################################################
diff  --git a/clang/docs/tools/clang-formatted-files.txt b/clang/docs/tools/clang-formatted-files.txt
index fc07357986d989..48ded9c7545547 100644
--- a/clang/docs/tools/clang-formatted-files.txt
+++ b/clang/docs/tools/clang-formatted-files.txt
@@ -5349,7 +5349,6 @@ llvm/include/llvm/IR/SSAContext.h
 llvm/include/llvm/IR/StructuralHash.h
 llvm/include/llvm/IR/TrackingMDRef.h
 llvm/include/llvm/IR/UseListOrder.h
-llvm/include/llvm/LTO/SummaryBasedOptimizations.h
 llvm/include/llvm/MC/MCAsmInfoCOFF.h
 llvm/include/llvm/MC/MCAsmInfoDarwin.h
 llvm/include/llvm/MC/MCAsmInfoELF.h
@@ -5586,7 +5585,6 @@ llvm/include/llvm/Transforms/IPO/SampleProfile.h
 llvm/include/llvm/Transforms/IPO/SampleProfileProbe.h
 llvm/include/llvm/Transforms/IPO/SCCP.h
 llvm/include/llvm/Transforms/IPO/StripSymbols.h
-llvm/include/llvm/Transforms/IPO/SyntheticCountsPropagation.h
 llvm/include/llvm/Transforms/IPO/ThinLTOBitcodeWriter.h
 llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h
 llvm/include/llvm/Transforms/Scalar/ADCE.h
@@ -6070,7 +6068,6 @@ llvm/lib/IR/SSAContext.cpp
 llvm/lib/IR/Statepoint.cpp
 llvm/lib/IR/StructuralHash.cpp
 llvm/lib/IR/ValueSymbolTable.cpp
-llvm/lib/LTO/SummaryBasedOptimizations.cpp
 llvm/lib/MC/MCAsmInfoCOFF.cpp
 llvm/lib/MC/MCAsmInfoELF.cpp
 llvm/lib/MC/MCAsmInfoGOFF.cpp
@@ -6861,7 +6858,6 @@ llvm/lib/Transforms/IPO/OpenMPOpt.cpp
 llvm/lib/Transforms/IPO/SampleContextTracker.cpp
 llvm/lib/Transforms/IPO/SampleProfileProbe.cpp
 llvm/lib/Transforms/IPO/StripDeadPrototypes.cpp
-llvm/lib/Transforms/IPO/SyntheticCountsPropagation.cpp
 llvm/lib/Transforms/ObjCARC/BlotMapVector.h
 llvm/lib/Transforms/ObjCARC/ObjCARCExpand.cpp
 llvm/lib/Transforms/ObjCARC/ProvenanceAnalysis.h

diff  --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index e4d188dc22d7c5..701c67f1b0af2b 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -858,9 +858,8 @@ class FunctionSummary : public GlobalValueSummary {
             GlobalValue::DefaultVisibility,
             /*NotEligibleToImport=*/true, /*Live=*/true, /*IsLocal=*/false,
             /*CanAutoHide=*/false, GlobalValueSummary::ImportKind::Definition),
-        /*NumInsts=*/0, FunctionSummary::FFlags{}, /*EntryCount=*/0,
-        SmallVector<ValueInfo, 0>(), std::move(Edges),
-        std::vector<GlobalValue::GUID>(),
+        /*NumInsts=*/0, FunctionSummary::FFlags{}, SmallVector<ValueInfo, 0>(),
+        std::move(Edges), std::vector<GlobalValue::GUID>(),
         std::vector<FunctionSummary::VFuncId>(),
         std::vector<FunctionSummary::VFuncId>(),
         std::vector<FunctionSummary::ConstVCall>(),
@@ -880,11 +879,6 @@ class FunctionSummary : public GlobalValueSummary {
   /// Function summary specific flags.
   FFlags FunFlags;
 
-  /// The synthesized entry count of the function.
-  /// This is only populated during ThinLink phase and remains unused while
-  /// generating per-module summaries.
-  uint64_t EntryCount = 0;
-
   /// List of <CalleeValueInfo, CalleeInfo> call edge pairs from this function.
   std::vector<EdgeTy> CallGraphEdgeList;
 
@@ -915,7 +909,7 @@ class FunctionSummary : public GlobalValueSummary {
 
 public:
   FunctionSummary(GVFlags Flags, unsigned NumInsts, FFlags FunFlags,
-                  uint64_t EntryCount, SmallVectorImpl<ValueInfo> &&Refs,
+                  SmallVectorImpl<ValueInfo> &&Refs,
                   std::vector<EdgeTy> CGEdges,
                   std::vector<GlobalValue::GUID> TypeTests,
                   std::vector<VFuncId> TypeTestAssumeVCalls,
@@ -925,7 +919,7 @@ class FunctionSummary : public GlobalValueSummary {
                   std::vector<ParamAccess> Params, CallsitesTy CallsiteList,
                   AllocsTy AllocList)
       : GlobalValueSummary(FunctionKind, Flags, std::move(Refs)),
-        InstCount(NumInsts), FunFlags(FunFlags), EntryCount(EntryCount),
+        InstCount(NumInsts), FunFlags(FunFlags),
         CallGraphEdgeList(std::move(CGEdges)) {
     if (!TypeTests.empty() || !TypeTestAssumeVCalls.empty() ||
         !TypeCheckedLoadVCalls.empty() || !TypeTestAssumeConstVCalls.empty() ||
@@ -960,12 +954,6 @@ class FunctionSummary : public GlobalValueSummary {
   /// Get the instruction count recorded for this function.
   unsigned instCount() const { return InstCount; }
 
-  /// Get the synthetic entry count for this function.
-  uint64_t entryCount() const { return EntryCount; }
-
-  /// Set the synthetic entry count for this function.
-  void setEntryCount(uint64_t EC) { EntryCount = EC; }
-
   /// Return the list of <CalleeValueInfo, CalleeInfo> pairs.
   ArrayRef<EdgeTy> calls() const { return CallGraphEdgeList; }
 
@@ -1587,9 +1575,6 @@ class ModuleSummaryIndex {
     return WithAttributePropagation && GVS->maybeWriteOnly();
   }
 
-  bool hasSyntheticEntryCounts() const { return HasSyntheticEntryCounts; }
-  void setHasSyntheticEntryCounts() { HasSyntheticEntryCounts = true; }
-
   bool withSupportsHotColdNew() const { return WithSupportsHotColdNew; }
   void setWithSupportsHotColdNew() { WithSupportsHotColdNew = true; }
 

diff  --git a/llvm/include/llvm/IR/ModuleSummaryIndexYAML.h b/llvm/include/llvm/IR/ModuleSummaryIndexYAML.h
index ec2907ca7662e2..8bfdd69a0bafaa 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndexYAML.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndexYAML.h
@@ -229,9 +229,9 @@ template <> struct CustomMappingTraits<GlobalValueSummaryMapTy> {
               FSum.NotEligibleToImport, FSum.Live, FSum.IsLocal,
               FSum.CanAutoHide,
               static_cast<GlobalValueSummary::ImportKind>(FSum.ImportType)),
-          /*NumInsts=*/0, FunctionSummary::FFlags{}, /*EntryCount=*/0,
-          std::move(Refs), ArrayRef<FunctionSummary::EdgeTy>{},
-          std::move(FSum.TypeTests), std::move(FSum.TypeTestAssumeVCalls),
+          /*NumInsts=*/0, FunctionSummary::FFlags{}, std::move(Refs),
+          ArrayRef<FunctionSummary::EdgeTy>{}, std::move(FSum.TypeTests),
+          std::move(FSum.TypeTestAssumeVCalls),
           std::move(FSum.TypeCheckedLoadVCalls),
           std::move(FSum.TypeTestAssumeConstVCalls),
           std::move(FSum.TypeCheckedLoadConstVCalls),

diff  --git a/llvm/include/llvm/LTO/SummaryBasedOptimizations.h b/llvm/include/llvm/LTO/SummaryBasedOptimizations.h
deleted file mode 100644
index 508ab2587ac56a..00000000000000
--- a/llvm/include/llvm/LTO/SummaryBasedOptimizations.h
+++ /dev/null
@@ -1,18 +0,0 @@
-//=- llvm/LTO/SummaryBasedOptimizations.h -Link time optimizations-*- C++ -*-=//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LTO_SUMMARYBASEDOPTIMIZATIONS_H
-#define LLVM_LTO_SUMMARYBASEDOPTIMIZATIONS_H
-namespace llvm {
-class ModuleSummaryIndex;
-
-/// Compute synthetic function entry counts.
-void computeSyntheticCounts(ModuleSummaryIndex &Index);
-
-} // namespace llvm
-#endif

diff  --git a/llvm/include/llvm/Transforms/IPO/SyntheticCountsPropagation.h b/llvm/include/llvm/Transforms/IPO/SyntheticCountsPropagation.h
deleted file mode 100644
index 5338ac9b0ebc57..00000000000000
--- a/llvm/include/llvm/Transforms/IPO/SyntheticCountsPropagation.h
+++ /dev/null
@@ -1,23 +0,0 @@
-//=- SyntheticCountsPropagation.h - Propagate function counts -----*- C++ -*-=//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_TRANSFORMS_IPO_SYNTHETICCOUNTSPROPAGATION_H
-#define LLVM_TRANSFORMS_IPO_SYNTHETICCOUNTSPROPAGATION_H
-
-#include "llvm/IR/PassManager.h"
-
-namespace llvm {
-class Module;
-
-class SyntheticCountsPropagation
-    : public PassInfoMixin<SyntheticCountsPropagation> {
-public:
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
-};
-} // namespace llvm
-#endif

diff  --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
index 39e7926ea43fe0..95ef97a23a686e 100644
--- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
+++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
@@ -673,9 +673,9 @@ static void computeFunctionSummary(
   if (auto *SSI = GetSSICallback(F))
     ParamAccesses = SSI->getParamAccesses(Index);
   auto FuncSummary = std::make_unique<FunctionSummary>(
-      Flags, NumInsts, FunFlags, /*EntryCount=*/0, std::move(Refs),
-      CallGraphEdges.takeVector(), TypeTests.takeVector(),
-      TypeTestAssumeVCalls.takeVector(), TypeCheckedLoadVCalls.takeVector(),
+      Flags, NumInsts, FunFlags, std::move(Refs), CallGraphEdges.takeVector(),
+      TypeTests.takeVector(), TypeTestAssumeVCalls.takeVector(),
+      TypeCheckedLoadVCalls.takeVector(),
       TypeTestAssumeConstVCalls.takeVector(),
       TypeCheckedLoadConstVCalls.takeVector(), std::move(ParamAccesses),
       std::move(Callsites), std::move(Allocs));
@@ -963,7 +963,7 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex(
                         /* MayThrow */ true,
                         /* HasUnknownCall */ true,
                         /* MustBeUnreachable */ false},
-                    /*EntryCount=*/0, SmallVector<ValueInfo, 0>{},
+                    SmallVector<ValueInfo, 0>{},
                     ArrayRef<FunctionSummary::EdgeTy>{},
                     ArrayRef<GlobalValue::GUID>{},
                     ArrayRef<FunctionSummary::VFuncId>{},

diff  --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index da1dbe55fcec5a..8747e15115cf61 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -9453,8 +9453,8 @@ bool LLParser::parseFunctionSummary(std::string Name, GlobalValue::GUID GUID,
     return true;
 
   auto FS = std::make_unique<FunctionSummary>(
-      GVFlags, InstCount, FFlags, /*EntryCount=*/0, std::move(Refs),
-      std::move(Calls), std::move(TypeIdInfo.TypeTests),
+      GVFlags, InstCount, FFlags, std::move(Refs), std::move(Calls),
+      std::move(TypeIdInfo.TypeTests),
       std::move(TypeIdInfo.TypeTestAssumeVCalls),
       std::move(TypeIdInfo.TypeCheckedLoadVCalls),
       std::move(TypeIdInfo.TypeTestAssumeConstVCalls),

diff  --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index e52757fe952d2d..250ba425a5d591 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -7686,8 +7686,8 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
         PendingAllocs.clear();
       }
       auto FS = std::make_unique<FunctionSummary>(
-          Flags, InstCount, getDecodedFFlags(RawFunFlags), /*EntryCount=*/0,
-          std::move(Refs), std::move(Calls), std::move(PendingTypeTests),
+          Flags, InstCount, getDecodedFFlags(RawFunFlags), std::move(Refs),
+          std::move(Calls), std::move(PendingTypeTests),
           std::move(PendingTypeTestAssumeVCalls),
           std::move(PendingTypeCheckedLoadVCalls),
           std::move(PendingTypeTestAssumeConstVCalls),
@@ -7832,8 +7832,8 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
       ValueInfo VI = std::get<0>(getValueInfoFromValueId(ValueID));
       setSpecialRefs(Refs, NumRORefs, NumWORefs);
       auto FS = std::make_unique<FunctionSummary>(
-          Flags, InstCount, getDecodedFFlags(RawFunFlags), EntryCount,
-          std::move(Refs), std::move(Edges), std::move(PendingTypeTests),
+          Flags, InstCount, getDecodedFFlags(RawFunFlags), std::move(Refs),
+          std::move(Edges), std::move(PendingTypeTests),
           std::move(PendingTypeTestAssumeVCalls),
           std::move(PendingTypeCheckedLoadVCalls),
           std::move(PendingTypeTestAssumeConstVCalls),

diff  --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index bf2eea5bc1582e..1aeaf0955fbbf3 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -4740,7 +4740,8 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
         getEncodedGVSummaryFlags(FS->flags(), shouldImportValueAsDecl(FS)));
     NameVals.push_back(FS->instCount());
     NameVals.push_back(getEncodedFFlags(FS->fflags()));
-    NameVals.push_back(FS->entryCount());
+    // TODO: Stop writing entry count and bump bitcode version.
+    NameVals.push_back(0 /* EntryCount */);
 
     // Fill in below
     NameVals.push_back(0); // numrefs

diff  --git a/llvm/lib/IR/ModuleSummaryIndex.cpp b/llvm/lib/IR/ModuleSummaryIndex.cpp
index 6713d32fb787ce..a788e63d95a117 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.

diff  --git a/llvm/lib/LTO/CMakeLists.txt b/llvm/lib/LTO/CMakeLists.txt
index 9ba7698bc9954b..69ff08e1f374c4 100644
--- a/llvm/lib/LTO/CMakeLists.txt
+++ b/llvm/lib/LTO/CMakeLists.txt
@@ -3,7 +3,6 @@ add_llvm_component_library(LLVMLTO
   LTOBackend.cpp
   LTOModule.cpp
   LTOCodeGenerator.cpp
-  SummaryBasedOptimizations.cpp
   UpdateCompilerUsed.cpp
   ThinLTOCodeGenerator.cpp
 

diff  --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index b1aa89ac978134..68072563cb33d6 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -32,7 +32,6 @@
 #include "llvm/IR/Metadata.h"
 #include "llvm/IR/RuntimeLibcalls.h"
 #include "llvm/LTO/LTOBackend.h"
-#include "llvm/LTO/SummaryBasedOptimizations.h"
 #include "llvm/Linker/IRMover.h"
 #include "llvm/MC/TargetRegistry.h"
 #include "llvm/Object/IRObjectFile.h"
@@ -1693,9 +1692,6 @@ Error LTO::runThinLTO(AddStreamFn AddStream, FileCache Cache,
     if (!ModuleToDefinedGVSummaries.count(Mod.first))
       ModuleToDefinedGVSummaries.try_emplace(Mod.first);
 
-  // Synthesize entry counts for functions in the CombinedIndex.
-  computeSyntheticCounts(ThinLTO.CombinedIndex);
-
   FunctionImporter::ImportListsTy ImportLists(ThinLTO.ModuleMap.size());
   DenseMap<StringRef, FunctionImporter::ExportSetTy> ExportLists(
       ThinLTO.ModuleMap.size());

diff  --git a/llvm/lib/LTO/SummaryBasedOptimizations.cpp b/llvm/lib/LTO/SummaryBasedOptimizations.cpp
deleted file mode 100644
index bd3565771c293c..00000000000000
--- a/llvm/lib/LTO/SummaryBasedOptimizations.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-//==-SummaryBasedOptimizations.cpp - Optimizations based on ThinLTO summary-==//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements optimizations that are based on the module summaries.
-// These optimizations are performed during the thinlink phase of the
-// compilation.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/LTO/SummaryBasedOptimizations.h"
-#include "llvm/Analysis/SyntheticCountsUtils.h"
-#include "llvm/IR/ModuleSummaryIndex.h"
-#include "llvm/Support/CommandLine.h"
-
-using namespace llvm;
-
-static cl::opt<bool> ThinLTOSynthesizeEntryCounts(
-    "thinlto-synthesize-entry-counts", cl::init(false), cl::Hidden,
-    cl::desc("Synthesize entry counts based on the summary"));
-
-namespace llvm {
-extern cl::opt<int> InitialSyntheticCount;
-}
-
-static void initializeCounts(ModuleSummaryIndex &Index) {
-  auto Root = Index.calculateCallGraphRoot();
-  // Root is a fake node. All its successors are the actual roots of the
-  // callgraph.
-  // FIXME: This initializes the entry counts of only the root nodes. This makes
-  // sense when compiling a binary with ThinLTO, but for libraries any of the
-  // non-root nodes could be called from outside.
-  for (auto &C : Root.calls()) {
-    auto &V = C.first;
-    for (auto &GVS : V.getSummaryList()) {
-      auto S = GVS.get()->getBaseObject();
-      auto *F = cast<FunctionSummary>(S);
-      F->setEntryCount(InitialSyntheticCount);
-    }
-  }
-}
-
-void llvm::computeSyntheticCounts(ModuleSummaryIndex &Index) {
-  if (!ThinLTOSynthesizeEntryCounts)
-    return;
-
-  using Scaled64 = ScaledNumber<uint64_t>;
-  initializeCounts(Index);
-  auto GetCallSiteRelFreq = [](FunctionSummary::EdgeTy &Edge) {
-    return Scaled64(Edge.second.RelBlockFreq, -CalleeInfo::ScaleShift);
-  };
-  auto GetEntryCount = [](ValueInfo V) {
-    if (V.getSummaryList().size()) {
-      auto S = V.getSummaryList().front()->getBaseObject();
-      auto *F = cast<FunctionSummary>(S);
-      return F->entryCount();
-    } else {
-      return UINT64_C(0);
-    }
-  };
-  auto AddToEntryCount = [](ValueInfo V, Scaled64 New) {
-    if (!V.getSummaryList().size())
-      return;
-    for (auto &GVS : V.getSummaryList()) {
-      auto S = GVS.get()->getBaseObject();
-      auto *F = cast<FunctionSummary>(S);
-      F->setEntryCount(
-          SaturatingAdd(F->entryCount(), New.template toInt<uint64_t>()));
-    }
-  };
-
-  auto GetProfileCount = [&](ValueInfo V, FunctionSummary::EdgeTy &Edge) {
-    auto RelFreq = GetCallSiteRelFreq(Edge);
-    Scaled64 EC(GetEntryCount(V), 0);
-    return RelFreq * EC;
-  };
-  // After initializing the counts in initializeCounts above, the counts have to
-  // be propagated across the combined callgraph.
-  // SyntheticCountsUtils::propagate takes care of this propagation on any
-  // callgraph that specialized GraphTraits.
-  SyntheticCountsUtils<ModuleSummaryIndex *>::propagate(&Index, GetProfileCount,
-                                                        AddToEntryCount);
-  Index.setHasSyntheticEntryCounts();
-}

diff  --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index 9d5a62fe10c8d7..76268c950cf581 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -27,15 +27,14 @@
 #include "llvm/Config/llvm-config.h"
 #include "llvm/IR/DebugInfo.h"
 #include "llvm/IR/DiagnosticPrinter.h"
-#include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/LLVMRemarkStreamer.h"
+#include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/Mangler.h"
 #include "llvm/IR/PassTimingInfo.h"
 #include "llvm/IR/Verifier.h"
 #include "llvm/IRReader/IRReader.h"
 #include "llvm/LTO/LTO.h"
-#include "llvm/LTO/SummaryBasedOptimizations.h"
 #include "llvm/MC/TargetRegistry.h"
 #include "llvm/Object/IRObjectFile.h"
 #include "llvm/Passes/PassBuilder.h"
@@ -1042,9 +1041,6 @@ void ThinLTOCodeGenerator::run() {
   // Compute "dead" symbols, we don't want to import/export these!
   computeDeadSymbolsInIndex(*Index, GUIDPreservedSymbols);
 
-  // Synthesize entry counts for functions in the combined index.
-  computeSyntheticCounts(*Index);
-
   // Currently there is no support for enabling whole program visibility via a
   // linker option in the old LTO API, but this call allows it to be specified
   // via the internal option. Must be done before WPD below.

diff  --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index 1500087bbb7118..83c1a6712bf4d9 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -180,7 +180,6 @@
 #include "llvm/Transforms/IPO/SampleProfileProbe.h"
 #include "llvm/Transforms/IPO/StripDeadPrototypes.h"
 #include "llvm/Transforms/IPO/StripSymbols.h"
-#include "llvm/Transforms/IPO/SyntheticCountsPropagation.h"
 #include "llvm/Transforms/IPO/WholeProgramDevirt.h"
 #include "llvm/Transforms/InstCombine/InstCombine.h"
 #include "llvm/Transforms/Instrumentation.h"

diff  --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index 38297dc02b8be6..7f9e1362e7ef23 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -68,7 +68,6 @@
 #include "llvm/Transforms/IPO/SCCP.h"
 #include "llvm/Transforms/IPO/SampleProfile.h"
 #include "llvm/Transforms/IPO/SampleProfileProbe.h"
-#include "llvm/Transforms/IPO/SyntheticCountsPropagation.h"
 #include "llvm/Transforms/IPO/WholeProgramDevirt.h"
 #include "llvm/Transforms/InstCombine/InstCombine.h"
 #include "llvm/Transforms/Instrumentation/CGProfile.h"
@@ -155,11 +154,6 @@ static cl::opt<InliningAdvisorMode> UseInlineAdvisor(
                clEnumValN(InliningAdvisorMode::Release, "release",
                           "Use release mode (AOT-compiled model)")));
 
-static cl::opt<bool> EnableSyntheticCounts(
-    "enable-npm-synthetic-counts", cl::Hidden,
-    cl::desc("Run synthetic function entry count generation "
-             "pass"));
-
 /// Flag to enable inline deferral during PGO.
 static cl::opt<bool>
     EnablePGOInlineDeferral("enable-npm-pgo-inline-deferral", cl::init(true),
@@ -1213,10 +1207,6 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
   if (IsMemprofUse)
     MPM.addPass(MemProfUsePass(PGOOpt->MemoryProfile, PGOOpt->FS));
 
-  // Synthesize function entry counts for non-PGO compilation.
-  if (EnableSyntheticCounts && !PGOOpt)
-    MPM.addPass(SyntheticCountsPropagation());
-
   if (PGOOpt && (PGOOpt->Action == PGOOptions::IRUse ||
                  PGOOpt->Action == PGOOptions::SampleUse))
     MPM.addPass(PGOForceFunctionAttrsPass(PGOOpt->ColdOptType));

diff  --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index 9e5ea2f6be522f..1769c2496a7b8e 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -147,7 +147,6 @@ MODULE_PASS("strip-dead-prototypes", StripDeadPrototypesPass())
 MODULE_PASS("strip-debug-declare", StripDebugDeclarePass())
 MODULE_PASS("strip-nondebug", StripNonDebugSymbolsPass())
 MODULE_PASS("strip-nonlinetable-debuginfo", StripNonLineTableDebugInfoPass())
-MODULE_PASS("synthetic-counts-propagation", SyntheticCountsPropagation())
 MODULE_PASS("trigger-crash-module", TriggerCrashModulePass())
 MODULE_PASS("trigger-verifier-error", TriggerVerifierErrorPass())
 MODULE_PASS("tsan-module", ModuleThreadSanitizerPass())

diff  --git a/llvm/lib/Transforms/IPO/CMakeLists.txt b/llvm/lib/Transforms/IPO/CMakeLists.txt
index 92a9697720efd4..15cb57399d2460 100644
--- a/llvm/lib/Transforms/IPO/CMakeLists.txt
+++ b/llvm/lib/Transforms/IPO/CMakeLists.txt
@@ -41,7 +41,6 @@ add_llvm_component_library(LLVMipo
   SCCP.cpp
   StripDeadPrototypes.cpp
   StripSymbols.cpp
-  SyntheticCountsPropagation.cpp
   ThinLTOBitcodeWriter.cpp
   WholeProgramDevirt.cpp
 

diff  --git a/llvm/lib/Transforms/IPO/SyntheticCountsPropagation.cpp b/llvm/lib/Transforms/IPO/SyntheticCountsPropagation.cpp
deleted file mode 100644
index f6f8956760848a..00000000000000
--- a/llvm/lib/Transforms/IPO/SyntheticCountsPropagation.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-//=- SyntheticCountsPropagation.cpp - Propagate function counts --*- C++ -*-=//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements a transformation that synthesizes entry counts for
-// functions and attaches !prof metadata to functions with the synthesized
-// counts. The presence of !prof metadata with counter name set to
-// 'synthesized_function_entry_count' indicate that the value of the counter is
-// an estimation of the likely execution count of the function. This transform
-// is applied only in non PGO mode as functions get 'real' profile-based
-// function entry counts in the PGO mode.
-//
-// The transformation works by first assigning some initial values to the entry
-// counts of all functions and then doing a top-down traversal of the
-// callgraph-scc to propagate the counts. For each function the set of callsites
-// and their relative block frequency is gathered. The relative block frequency
-// multiplied by the entry count of the caller and added to the callee's entry
-// count. For non-trivial SCCs, the new counts are computed from the previous
-// counts and updated in one shot.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Transforms/IPO/SyntheticCountsPropagation.h"
-#include "llvm/Analysis/BlockFrequencyInfo.h"
-#include "llvm/Analysis/CallGraph.h"
-#include "llvm/Analysis/SyntheticCountsUtils.h"
-#include "llvm/IR/Function.h"
-#include "llvm/IR/Instructions.h"
-#include "llvm/IR/Module.h"
-#include "llvm/Support/CommandLine.h"
-
-using namespace llvm;
-using Scaled64 = ScaledNumber<uint64_t>;
-using ProfileCount = Function::ProfileCount;
-
-#define DEBUG_TYPE "synthetic-counts-propagation"
-
-namespace llvm {
-cl::opt<int>
-    InitialSyntheticCount("initial-synthetic-count", cl::Hidden, cl::init(10),
-                          cl::desc("Initial value of synthetic entry count"));
-} // namespace llvm
-
-/// Initial synthetic count assigned to inline functions.
-static cl::opt<int> InlineSyntheticCount(
-    "inline-synthetic-count", cl::Hidden, cl::init(15),
-    cl::desc("Initial synthetic entry count for inline functions."));
-
-/// Initial synthetic count assigned to cold functions.
-static cl::opt<int> ColdSyntheticCount(
-    "cold-synthetic-count", cl::Hidden, cl::init(5),
-    cl::desc("Initial synthetic entry count for cold functions."));
-
-// Assign initial synthetic entry counts to functions.
-static void
-initializeCounts(Module &M, function_ref<void(Function *, uint64_t)> SetCount) {
-  auto MayHaveIndirectCalls = [](Function &F) {
-    for (auto *U : F.users()) {
-      if (!isa<CallInst>(U) && !isa<InvokeInst>(U))
-        return true;
-    }
-    return false;
-  };
-
-  for (Function &F : M) {
-    uint64_t InitialCount = InitialSyntheticCount;
-    if (F.isDeclaration())
-      continue;
-    if (F.hasFnAttribute(Attribute::AlwaysInline) ||
-        F.hasFnAttribute(Attribute::InlineHint)) {
-      // Use a higher value for inline functions to account for the fact that
-      // these are usually beneficial to inline.
-      InitialCount = InlineSyntheticCount;
-    } else if (F.hasLocalLinkage() && !MayHaveIndirectCalls(F)) {
-      // Local functions without inline hints get counts only through
-      // propagation.
-      InitialCount = 0;
-    } else if (F.hasFnAttribute(Attribute::Cold) ||
-               F.hasFnAttribute(Attribute::NoInline)) {
-      // Use a lower value for noinline and cold functions.
-      InitialCount = ColdSyntheticCount;
-    }
-    SetCount(&F, InitialCount);
-  }
-}
-
-PreservedAnalyses SyntheticCountsPropagation::run(Module &M,
-                                                  ModuleAnalysisManager &MAM) {
-  FunctionAnalysisManager &FAM =
-      MAM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
-  DenseMap<Function *, Scaled64> Counts;
-  // Set initial entry counts.
-  initializeCounts(
-      M, [&](Function *F, uint64_t Count) { Counts[F] = Scaled64(Count, 0); });
-
-  // Edge includes information about the source. Hence ignore the first
-  // parameter.
-  auto GetCallSiteProfCount = [&](const CallGraphNode *,
-                                  const CallGraphNode::CallRecord &Edge) {
-    std::optional<Scaled64> Res;
-    if (!Edge.first)
-      return Res;
-    CallBase &CB = *cast<CallBase>(*Edge.first);
-    Function *Caller = CB.getCaller();
-    auto &BFI = FAM.getResult<BlockFrequencyAnalysis>(*Caller);
-
-    // Now compute the callsite count from relative frequency and
-    // entry count:
-    BasicBlock *CSBB = CB.getParent();
-    Scaled64 EntryFreq(BFI.getEntryFreq().getFrequency(), 0);
-    Scaled64 BBCount(BFI.getBlockFreq(CSBB).getFrequency(), 0);
-    BBCount /= EntryFreq;
-    BBCount *= Counts[Caller];
-    return std::optional<Scaled64>(BBCount);
-  };
-
-  CallGraph CG(M);
-  // Propgate the entry counts on the callgraph.
-  SyntheticCountsUtils<const CallGraph *>::propagate(
-      &CG, GetCallSiteProfCount, [&](const CallGraphNode *N, Scaled64 New) {
-        auto F = N->getFunction();
-        if (!F || F->isDeclaration())
-          return;
-
-        Counts[F] += New;
-      });
-
-  // Set the counts as metadata.
-  for (auto Entry : Counts) {
-    Entry.first->setEntryCount(ProfileCount(
-        Entry.second.template toInt<uint64_t>(), Function::PCT_Synthetic));
-  }
-
-  return PreservedAnalyses::all();
-}

diff  --git a/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp b/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
index 87be6be018857c..766c7501550da5 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.

diff  --git a/llvm/test/Bitcode/thinlto-synthetic-count-flag.ll b/llvm/test/Bitcode/thinlto-synthetic-count-flag.ll
deleted file mode 100644
index 1b92a15145ca43..00000000000000
--- a/llvm/test/Bitcode/thinlto-synthetic-count-flag.ll
+++ /dev/null
@@ -1,21 +0,0 @@
-; REQUIRES: x86-registered-target
-; RUN: opt -module-summary %s -o %t.o
-
-; Ensure synthetic entry count flag is not set on distributed index
-; RUN: llvm-lto2 run %t.o -o %t.out -thinlto-distributed-indexes \
-; RUN:		-r %t.o,glob,plx -compute-dead=false
-; RUN: llvm-bcanalyzer -dump %t.o.thinlto.bc | FileCheck %s --check-prefix=NOSYNTHETIC
-; NOSYNTHETIC: <FLAGS op0=96/>
-
-; Ensure synthetic entry count flag is set on distributed index
-; when option used to enable synthetic count propagation
-; RUN: llvm-lto2 run %t.o -o %t.out -thinlto-distributed-indexes \
-; RUN:		-r %t.o,glob,plx -thinlto-synthesize-entry-counts \
-; RUN:          -compute-dead=false
-; RUN: llvm-bcanalyzer -dump %t.o.thinlto.bc | FileCheck %s --check-prefix=HASSYNTHETIC
-; HASSYNTHETIC: <FLAGS op0=100/>
-
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
- at glob = global i32 0

diff  --git a/llvm/test/ThinLTO/X86/function_entry_count.ll b/llvm/test/ThinLTO/X86/function_entry_count.ll
deleted file mode 100644
index b65bc226040bfc..00000000000000
--- a/llvm/test/ThinLTO/X86/function_entry_count.ll
+++ /dev/null
@@ -1,45 +0,0 @@
-; RUN: opt -thinlto-bc %s -write-relbf-to-summary -thin-link-bitcode-file=%t1.thinlink.bc -o %t1.bc
-; RUN: opt -thinlto-bc %p/Inputs/function_entry_count.ll -write-relbf-to-summary -thin-link-bitcode-file=%t2.thinlink.bc -o %t2.bc
-
-; First perform the thin link on the normal bitcode file.
-; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps -disable-thinlto-funcattrs=0 -thinlto-synthesize-entry-counts \
-; RUN:     -r=%t1.bc,g, \
-; RUN:     -r=%t1.bc,f,px \
-; RUN:     -r=%t1.bc,h,px \
-; RUN:     -r=%t2.bc,h, \
-; RUN:     -r=%t2.bc,g,px
-; RUN: llvm-dis -o - %t.o.1.3.import.bc | FileCheck %s
-
-; RUN: llvm-lto -thinlto-action=run -disable-thinlto-funcattrs=0 -thinlto-synthesize-entry-counts -exported-symbol=f \
-; RUN:     -exported-symbol=g -exported-symbol=h -thinlto-save-temps=%t3. %t1.bc %t2.bc
-; RUN: llvm-dis %t3.0.3.imported.bc -o - | FileCheck %s
-
-; CHECK: define void @h() [[ATTR:#[0-9]+]] !prof ![[PROF2:[0-9]+]]
-; CHECK: define void @f(i32{{.*}}) [[ATTR:#[0-9]+]] !prof ![[PROF1:[0-9]+]]
-; CHECK: define available_externally void @g() !prof ![[PROF2]]
-; CHECK-DAG: ![[PROF1]] = !{!"synthetic_function_entry_count", i64 10}
-; CHECK-DAG: ![[PROF2]] = !{!"synthetic_function_entry_count", i64 200}
-; CHECK-DAG: attributes [[ATTR]] = { norecurse nounwind }
-
-target triple = "x86_64-unknown-linux-gnu"
-target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-
-declare void @g();
-
-define void @h() {
-  ret void
-}
-
-define void @f(i32 %n) {
-entry:
-  %cmp = icmp slt i32 %n, 1
-  br i1 %cmp, label %exit, label %loop
-loop:
-  %n1 = phi i32 [%n, %entry], [%n2, %loop]
-  call void  @g()
-  %n2 = sub i32 %n1, 1
-  %cmp2 = icmp slt i32 %n, 1
-  br i1 %cmp2, label %exit, label %loop
-exit:
-  ret void
-}

diff  --git a/llvm/test/Transforms/SyntheticCountsPropagation/initial.ll b/llvm/test/Transforms/SyntheticCountsPropagation/initial.ll
deleted file mode 100644
index 40f7111247e4a1..00000000000000
--- a/llvm/test/Transforms/SyntheticCountsPropagation/initial.ll
+++ /dev/null
@@ -1,79 +0,0 @@
-; RUN: opt -passes=synthetic-counts-propagation -S < %s | FileCheck %s
-
-; CHECK-LABEL: define void @foo()
-; CHECK: !prof ![[COUNT1:[0-9]+]]
-define void @foo() {
-  ret void
-}
-
-; CHECK-LABEL: define void @foo_inline() #0
-; CHECK: !prof ![[COUNT2:[0-9]+]]
-define void @foo_inline() #0 {
-  ret void
-}
-
-; CHECK-LABEL: define void @foo_always_inline() #1
-; CHECK: !prof ![[COUNT2]]
-define void @foo_always_inline() #1 {
-  ret void
-}
-
-; CHECK-LABEL: define void @foo_cold() #2
-; CHECK: !prof ![[COUNT3:[0-9]+]]
-define void @foo_cold() #2 {
-  ret void
-}
-
-; CHECK-LABEL: define void @foo_noinline() #3
-; CHECK: !prof ![[COUNT3]]
-define void @foo_noinline() #3 {
-  ret void
-}
-
-; CHECK-LABEL: define internal void @foo_local()
-; CHECK: !prof ![[COUNT4:[0-9]+]]
-define internal void @foo_local() {
-  ret void
-}
-
-; CHECK-LABEL: define internal void @foo_local_escaped()
-; CHECK: !prof ![[COUNT1]]
-define internal void @foo_local_escaped() {
-  ret void
-}
-
-declare void @ext(ptr)
-
-define void @bar() {
-  call void @ext(ptr nonnull @foo_local_escaped)
-  ret void
-}
-
-; CHECK-LABEL: define internal void @foo_local_inline() #0
-; CHECK: !prof ![[COUNT2]]
-define internal void @foo_local_inline() #0 {
-  ret void
-}
-
-; CHECK-LABEL: define internal void @foo_local_cold() #2
-; CHECK: !prof ![[COUNT4]]
-define internal void @foo_local_cold() #2 {
-  ret void
-}
-
-; CHECK-LABEL: define linkonce void @foo_linkonce()
-; CHECK: !prof ![[COUNT1]]
-define linkonce void @foo_linkonce() {
-  ret void
-}
-
-; CHECK: ![[COUNT1]] = !{!"synthetic_function_entry_count", i64 10}
-; CHECK: ![[COUNT2]] = !{!"synthetic_function_entry_count", i64 15}
-; CHECK: ![[COUNT3]] = !{!"synthetic_function_entry_count", i64 5}
-; CHECK: ![[COUNT4]] = !{!"synthetic_function_entry_count", i64 0}
-
-attributes #0 = {inlinehint}
-attributes #1 = {alwaysinline}
-attributes #2 = {cold}
-attributes #3 = {noinline}
-

diff  --git a/llvm/test/Transforms/SyntheticCountsPropagation/prop.ll b/llvm/test/Transforms/SyntheticCountsPropagation/prop.ll
deleted file mode 100644
index 68fb8f523ed0d6..00000000000000
--- a/llvm/test/Transforms/SyntheticCountsPropagation/prop.ll
+++ /dev/null
@@ -1,50 +0,0 @@
-; RUN: opt -passes=synthetic-counts-propagation -S < %s | FileCheck %s
-
-; CHECK-LABEL: define void @level1a(i32 %n)
-; CHECK: !prof ![[COUNT1:[0-9]+]]
-define void @level1a(i32 %n) {
-entry:
-  %cmp = icmp sgt i32 %n, 10
-  br i1 %cmp, label %exit, label %loop
-loop:
-  %i = phi i32 [%n, %entry], [%i1, %loop]
-  call void @level2a(i32 %n)
-  %i1 = sub i32 %i, 1
-  %cmp2 = icmp eq i32 %i1, 0
-  br i1 %cmp2, label %exit, label %loop, !prof !1
-exit:
-  ret void
-}
-
-; CHECK-LABEL: define void @level2a(i32 %n)
-; CHECK: !prof ![[COUNT2:[0-9]+]]
-define void @level2a(i32 %n) {
-  call void @level2b(i32 %n)
-  ret void
-}
-
-; CHECK-LABEL: define void @level2b(i32 %n)
-; CHECK: !prof ![[COUNT2]]
-define void @level2b(i32 %n) {
-entry:
-  call void @level2a(i32 %n)
-  %cmp = icmp eq i32 %n, 0
-  br i1 %cmp, label %then, label %else, !prof !2
-then:
-  call void @level3a(i32 %n)
-  br label %else
-else:
-  ret void
-}
-
-; CHECK-LABEL: define internal void @level3a(i32 %n)
-; CHECK: !prof ![[COUNT3:[0-9]+]]
-define internal void @level3a(i32 %n) {
-  ret void
-}
-
-!1 = !{!"branch_weights", i32 1, i32 99}
-!2 = !{!"branch_weights", i32 1, i32 1}
-; CHECK: ![[COUNT1]] = !{!"synthetic_function_entry_count", i64 10}
-; CHECK: ![[COUNT2]] = !{!"synthetic_function_entry_count", i64 520}
-; CHECK: ![[COUNT3]] = !{!"synthetic_function_entry_count", i64 260}

diff  --git a/llvm/test/Transforms/SyntheticCountsPropagation/scc.ll b/llvm/test/Transforms/SyntheticCountsPropagation/scc.ll
deleted file mode 100644
index e2d9ada7fb451a..00000000000000
--- a/llvm/test/Transforms/SyntheticCountsPropagation/scc.ll
+++ /dev/null
@@ -1,19 +0,0 @@
-; RUN: opt -passes=synthetic-counts-propagation -S < %s | FileCheck %s
-
-; CHECK-LABEL: define void @foo()
-; CHECK: !prof ![[COUNT1:[0-9]+]]
-define void @foo() {
-  call void @bar()
-  ret void
-}
-
-; CHECK-LABEL: define void @bar() #0
-; CHECK: !prof ![[COUNT1]]
-define void @bar() #0 {
-  call void @foo()
-  ret void
-}
-
-attributes #0 = {inlinehint}
-
-; CHECK: ![[COUNT1]] = !{!"synthetic_function_entry_count", i64 25}

diff  --git a/llvm/utils/gn/secondary/llvm/lib/LTO/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/LTO/BUILD.gn
index 6c44a25b2acbea..001ca38177fe1d 100644
--- a/llvm/utils/gn/secondary/llvm/lib/LTO/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/LTO/BUILD.gn
@@ -27,7 +27,6 @@ static_library("LTO") {
     "LTOBackend.cpp",
     "LTOCodeGenerator.cpp",
     "LTOModule.cpp",
-    "SummaryBasedOptimizations.cpp",
     "ThinLTOCodeGenerator.cpp",
     "UpdateCompilerUsed.cpp",
   ]

diff  --git a/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn
index bcf2ea7510568d..9c7798116356fb 100644
--- a/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn
@@ -62,7 +62,6 @@ static_library("IPO") {
     "SampleProfileProbe.cpp",
     "StripDeadPrototypes.cpp",
     "StripSymbols.cpp",
-    "SyntheticCountsPropagation.cpp",
     "ThinLTOBitcodeWriter.cpp",
     "WholeProgramDevirt.cpp",
   ]


        


More information about the cfe-commits mailing list