llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-llvm-transforms Author: Aiden Grossman (boomanaiden154) <details> <summary>Changes</summary> This only exists to differentiate between real and synthetic profiles. Remove the abstraction now that we plan to fully remove synthetic profiles. --- Patch is 28.79 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/204770.diff 24 Files Affected: - (modified) llvm/include/llvm/Analysis/ProfileSummaryInfo.h (+1-1) - (modified) llvm/include/llvm/IR/Function.h (+2-24) - (modified) llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h (+2-7) - (modified) llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp (+1-1) - (modified) llvm/lib/Analysis/InlineCost.cpp (+4-5) - (modified) llvm/lib/Analysis/ProfileSummaryInfo.cpp (+1-1) - (modified) llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (+1-2) - (modified) llvm/lib/CodeGen/MIRSampleProfile.cpp (-1) - (modified) llvm/lib/CodeGen/MachineFunction.cpp (+1-3) - (modified) llvm/lib/IR/Function.cpp (+5-17) - (modified) llvm/lib/IR/ProfDataUtils.cpp (+2-4) - (modified) llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp (+2-2) - (modified) llvm/lib/Transforms/IPO/FunctionSpecialization.cpp (+4-5) - (modified) llvm/lib/Transforms/IPO/PartialInlining.cpp (+2-4) - (modified) llvm/lib/Transforms/IPO/SampleProfile.cpp (+1-2) - (modified) llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp (+2-2) - (modified) llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp (+5-7) - (modified) llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp (+4-4) - (modified) llvm/lib/Transforms/Utils/CodeExtractor.cpp (+1-3) - (modified) llvm/lib/Transforms/Utils/InlineFunction.cpp (+14-18) - (modified) llvm/lib/Transforms/Utils/LowerMemIntrinsics.cpp (+2-3) - (modified) llvm/lib/Transforms/Utils/ProfileVerify.cpp (+2-2) - (modified) llvm/lib/Transforms/Vectorize/VPlan.cpp (+1-1) - (modified) llvm/unittests/IR/MetadataTest.cpp (+3-4) ``````````diff diff --git a/llvm/include/llvm/Analysis/ProfileSummaryInfo.h b/llvm/include/llvm/Analysis/ProfileSummaryInfo.h index 547bc344d314b..b74af34b308e7 100644 --- a/llvm/include/llvm/Analysis/ProfileSummaryInfo.h +++ b/llvm/include/llvm/Analysis/ProfileSummaryInfo.h @@ -327,7 +327,7 @@ class ProfileSummaryInfo { std::optional<uint64_t> getEntryCount(const FuncT *F) const { if (!F->getEntryCount().has_value()) return std::nullopt; - return F->getEntryCount()->getCount(); + return F->getEntryCount(); } }; diff --git a/llvm/include/llvm/IR/Function.h b/llvm/include/llvm/IR/Function.h index 0b48e088c3db2..bd28f0d9902da 100644 --- a/llvm/include/llvm/IR/Function.h +++ b/llvm/include/llvm/IR/Function.h @@ -291,41 +291,19 @@ class LLVM_ABI Function : public GlobalObject, public ilist_node<Function> { } } - enum ProfileCountType { PCT_Real, PCT_Synthetic }; - - /// Class to represent profile counts. - /// - /// This class represents both real and synthetic profile counts. - class ProfileCount { - private: - uint64_t Count = 0; - ProfileCountType PCT = PCT_Real; - - public: - ProfileCount(uint64_t Count, ProfileCountType PCT) - : Count(Count), PCT(PCT) {} - uint64_t getCount() const { return Count; } - ProfileCountType getType() const { return PCT; } - bool isSynthetic() const { return PCT == PCT_Synthetic; } - }; - /// Set the entry count for this function. /// /// Entry count is the number of times this function was executed based on /// pgo data. \p Imports points to a set of GUIDs that needs to /// be imported by the function for sample PGO, to enable the same inlines as /// the profiled optimized binary. - void setEntryCount(ProfileCount Count, - const DenseSet<GlobalValue::GUID> *Imports = nullptr); - - /// A convenience wrapper for setting entry count - void setEntryCount(uint64_t Count, ProfileCountType Type = PCT_Real, + void setEntryCount(uint64_t Count, const DenseSet<GlobalValue::GUID> *Imports = nullptr); /// Get the entry count for this function. /// /// Entry count is the number of times the function was executed. - std::optional<ProfileCount> getEntryCount() const; + std::optional<uint64_t> getEntryCount() const; /// Return true if the function is annotated with profile data. /// diff --git a/llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h b/llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h index 2e47ba63abcf0..5346871249cf5 100644 --- a/llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h +++ b/llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h @@ -47,7 +47,6 @@ namespace llvm { using namespace sampleprof; using namespace sampleprofutil; -using ProfileCount = Function::ProfileCount; namespace vfs { class FileSystem; @@ -1069,9 +1068,7 @@ void SampleProfileLoaderBaseImpl<BT>::initWeightPropagation( // Sets the GUIDs that are inlined in the profiled binary. This is used // for ThinLink to make correct liveness analysis, and also make the IR // match the profiled binary before annotation. - getFunction(F).setEntryCount( - ProfileCount(Samples->getHeadSamples() + 1, Function::PCT_Real), - &InlinedGUIDs); + getFunction(F).setEntryCount(Samples->getHeadSamples() + 1, &InlinedGUIDs); if (!SampleProfileUseProfi) { // Compute dominance and loop info needed for propagation. @@ -1101,9 +1098,7 @@ void SampleProfileLoaderBaseImpl<BT>::finalizeWeightPropagation( if (SampleProfileUseProfi) { const BasicBlockT *EntryBB = getEntryBB(&F); if (BlockWeights[EntryBB] > 0) { - getFunction(F).setEntryCount( - ProfileCount(BlockWeights[EntryBB], Function::PCT_Real), - &InlinedGUIDs); + getFunction(F).setEntryCount(BlockWeights[EntryBB], &InlinedGUIDs); } } } diff --git a/llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp b/llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp index 36af4f146ca42..b1e7b09306ac5 100644 --- a/llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp +++ b/llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp @@ -593,7 +593,7 @@ BlockFrequencyInfoImplBase::getProfileCountFromFreq(const Function &F, if (!EntryCount) return std::nullopt; // Use 128 bit APInt to do the arithmetic to avoid overflow. - APInt BlockCount(128, EntryCount->getCount()); + APInt BlockCount(128, *EntryCount); APInt BlockFreq(128, Freq.getFrequency()); APInt EntryFreq(128, getEntryFreq().getFrequency()); BlockCount *= BlockFreq; diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp index d975a93e9b1fd..55d5569dc6ba0 100644 --- a/llvm/lib/Analysis/InlineCost.cpp +++ b/llvm/lib/Analysis/InlineCost.cpp @@ -928,7 +928,7 @@ class InlineCostCallAnalyzer final : public CallAnalyzer { // Make sure we have a nonzero entry count. auto EntryCount = F.getEntryCount(); - if (!EntryCount || !EntryCount->getCount()) + if (!EntryCount || *EntryCount == 0) return false; BlockFrequencyInfo *CalleeBFI = &(GetBFI(F)); @@ -1017,10 +1017,9 @@ class InlineCostCallAnalyzer final : public CallAnalyzer { // Compute the cycle savings per call. auto EntryProfileCount = F.getEntryCount(); - assert(EntryProfileCount && EntryProfileCount->getCount()); - auto EntryCount = EntryProfileCount->getCount(); - CycleSavings += EntryCount / 2; - CycleSavings = CycleSavings.udiv(EntryCount); + assert(EntryProfileCount && *EntryProfileCount); + CycleSavings += *EntryProfileCount / 2; + CycleSavings = CycleSavings.udiv(*EntryProfileCount); // Compute the total savings for the call site. auto *CallerBB = CandidateCall.getParent(); diff --git a/llvm/lib/Analysis/ProfileSummaryInfo.cpp b/llvm/lib/Analysis/ProfileSummaryInfo.cpp index 59726e8ecdab1..a50c34d1b1007 100644 --- a/llvm/lib/Analysis/ProfileSummaryInfo.cpp +++ b/llvm/lib/Analysis/ProfileSummaryInfo.cpp @@ -114,7 +114,7 @@ bool ProfileSummaryInfo::isFunctionEntryCold(const Function *F) const { // FIXME: The heuristic used below for determining coldness is based on // preliminary SPEC tuning for inliner. This will eventually be a // convenience method that calls isHotCount. - return FunctionCount && isColdCount(FunctionCount->getCount()); + return FunctionCount && isColdCount(*FunctionCount); } /// Compute the hot and cold thresholds. diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index cdb9d760606f6..ec6194ae06a4c 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1608,8 +1608,7 @@ void AsmPrinter::emitBBAddrMapSection(const MachineFunction &MF) { if (Features.FuncEntryCount) { OutStreamer->AddComment("function entry count"); auto MaybeEntryCount = MF.getFunction().getEntryCount(); - OutStreamer->emitULEB128IntValue( - MaybeEntryCount ? MaybeEntryCount->getCount() : 0); + OutStreamer->emitULEB128IntValue(MaybeEntryCount ? *MaybeEntryCount : 0); } const MachineBlockFrequencyInfo *MBFI = Features.BBFreq diff --git a/llvm/lib/CodeGen/MIRSampleProfile.cpp b/llvm/lib/CodeGen/MIRSampleProfile.cpp index 913ad7a65d323..56ef30899879f 100644 --- a/llvm/lib/CodeGen/MIRSampleProfile.cpp +++ b/llvm/lib/CodeGen/MIRSampleProfile.cpp @@ -38,7 +38,6 @@ using namespace llvm; using namespace sampleprof; using namespace llvm::sampleprofutil; -using ProfileCount = Function::ProfileCount; #define DEBUG_TYPE "fs-profile-loader" diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index 8246b77ac9dce..b0ffdb36f21be 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -1669,9 +1669,7 @@ template <> std::optional<uint64_t> ProfileSummaryInfo::getEntryCount<llvm::MachineFunction>( const llvm::MachineFunction *F) const { - if (!F->getFunction().getEntryCount().has_value()) - return std::nullopt; - return F->getFunction().getEntryCount()->getCount(); + return F->getFunction().getEntryCount(); } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index ff5a11fbb08cd..03e91bc8e2aa4 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -56,7 +56,6 @@ #include <string> using namespace llvm; -using ProfileCount = Function::ProfileCount; // Explicit instantiations of SymbolTableListTraits since some of the methods // are not in the public header file... @@ -1079,29 +1078,18 @@ void Function::setValueSubclassDataBit(unsigned Bit, bool On) { setValueSubclassData(getSubclassDataFromValue() & ~(1 << Bit)); } -void Function::setEntryCount(ProfileCount Count, +void Function::setEntryCount(uint64_t Count, const DenseSet<GlobalValue::GUID> *S) { -#if !defined(NDEBUG) - auto PrevCount = getEntryCount(); - assert(!PrevCount || PrevCount->getType() == Count.getType()); -#endif - auto ImportGUIDs = getImportGUIDs(); if (S == nullptr && ImportGUIDs.size()) S = &ImportGUIDs; MDBuilder MDB(getContext()); - setMetadata( - LLVMContext::MD_prof, - MDB.createFunctionEntryCount(Count.getCount(), Count.isSynthetic(), S)); -} - -void Function::setEntryCount(uint64_t Count, Function::ProfileCountType Type, - const DenseSet<GlobalValue::GUID> *Imports) { - setEntryCount(ProfileCount(Count, Type), Imports); + setMetadata(LLVMContext::MD_prof, + MDB.createFunctionEntryCount(Count, false, S)); } -std::optional<ProfileCount> Function::getEntryCount() const { +std::optional<uint64_t> Function::getEntryCount() const { MDNode *MD = getMetadata(LLVMContext::MD_prof); if (MD && MD->getOperand(0)) if (MDString *MDS = dyn_cast<MDString>(MD->getOperand(0))) { @@ -1113,7 +1101,7 @@ std::optional<ProfileCount> Function::getEntryCount() const { // Treat this the same as unknown. if (Count == static_cast<uint64_t>(-1)) return std::nullopt; - return ProfileCount(Count, PCT_Real); + return Count; } return std::nullopt; } diff --git a/llvm/lib/IR/ProfDataUtils.cpp b/llvm/lib/IR/ProfDataUtils.cpp index 09794478103ea..34d46cb062bc3 100644 --- a/llvm/lib/IR/ProfDataUtils.cpp +++ b/llvm/lib/IR/ProfDataUtils.cpp @@ -282,15 +282,13 @@ void llvm::setExplicitlyUnknownBranchWeightsIfProfiled(Instruction &I, F = F ? F : I.getFunction(); assert(F && "Either pass a instruction attached to a Function, or explicitly " "pass the Function that it will be attached to"); - if (std::optional<Function::ProfileCount> EC = F->getEntryCount(); - EC && EC->getCount() > 0) + if (std::optional<uint64_t> EC = F->getEntryCount(); EC && *EC > 0) setExplicitlyUnknownBranchWeights(I, PassName); } MDNode *llvm::getExplicitlyUnknownBranchWeightsIfProfiled(Function &F, StringRef PassName) { - if (std::optional<Function::ProfileCount> EC = F.getEntryCount(); - !EC || EC->getCount() == 0) + if (std::optional<uint64_t> EC = F.getEntryCount(); !EC || *EC == 0) return nullptr; MDBuilder MDB(F.getContext()); return MDNode::get( diff --git a/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp b/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp index 18af4448087d7..b3a89f5e16258 100644 --- a/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp +++ b/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp @@ -1953,8 +1953,8 @@ void StrNCmpInliner::inlineCompare(Value *LHS, StringRef RHS, uint64_t N, Function *F = CI->getFunction(); assert(F && "Instruction does not belong to a function!"); - std::optional<Function::ProfileCount> EC = F->getEntryCount(); - if (EC && EC->getCount() > 0) + std::optional<uint64_t> EC = F->getEntryCount(); + if (EC && *EC > 0) setExplicitlyUnknownBranchWeights(*CondBrInst, DEBUG_TYPE); } else { B.CreateBr(BBNE); diff --git a/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp index a4844006319c9..e36090ac0e387 100644 --- a/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp +++ b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp @@ -795,14 +795,13 @@ bool FunctionSpecializer::run() { std::optional<uint64_t> Count = BFI.getBlockProfileCount(Call->getParent()); if (Count && !ProfcheckDisableMetadataFixes) { - std::optional<llvm::Function::ProfileCount> MaybeCloneCount = - Clone->getEntryCount(); + std::optional<uint64_t> MaybeCloneCount = Clone->getEntryCount(); if (MaybeCloneCount) { - uint64_t CallCount = *Count + MaybeCloneCount->getCount(); + uint64_t CallCount = *Count + *MaybeCloneCount; Clone->setEntryCount(CallCount); - if (std::optional<llvm::Function::ProfileCount> MaybeOriginalCount = + if (std::optional<uint64_t> MaybeOriginalCount = S.F->getEntryCount()) { - uint64_t OriginalCount = MaybeOriginalCount->getCount(); + uint64_t OriginalCount = *MaybeOriginalCount; if (OriginalCount >= *Count) { S.F->setEntryCount(OriginalCount - *Count); } else { diff --git a/llvm/lib/Transforms/IPO/PartialInlining.cpp b/llvm/lib/Transforms/IPO/PartialInlining.cpp index 31eac4064aaa2..b95ab41993d19 100644 --- a/llvm/lib/Transforms/IPO/PartialInlining.cpp +++ b/llvm/lib/Transforms/IPO/PartialInlining.cpp @@ -1355,8 +1355,7 @@ bool PartialInlinerImpl::tryPartialInline(FunctionCloner &Cloner) { if (CalleeEntryCount) computeCallsiteToProfCountMap(Cloner.ClonedFunc, CallSiteToProfCountMap); - uint64_t CalleeEntryCountV = - (CalleeEntryCount ? CalleeEntryCount->getCount() : 0); + uint64_t CalleeEntryCountV = (CalleeEntryCount ? *CalleeEntryCount : 0); bool AnyInline = false; for (User *User : Users) { @@ -1408,8 +1407,7 @@ bool PartialInlinerImpl::tryPartialInline(FunctionCloner &Cloner) { if (AnyInline) { Cloner.IsFunctionInlined = true; if (CalleeEntryCount) - Cloner.OrigFunc->setEntryCount(Function::ProfileCount( - CalleeEntryCountV, CalleeEntryCount->getType())); + Cloner.OrigFunc->setEntryCount(CalleeEntryCountV); OptimizationRemarkEmitter OrigFuncORE(Cloner.OrigFunc); OrigFuncORE.emit([&]() { return OptimizationRemark(DEBUG_TYPE, "PartiallyInlined", Cloner.OrigFunc) diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp index ab324ec76baa5..4234e05430dbf 100644 --- a/llvm/lib/Transforms/IPO/SampleProfile.cpp +++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp @@ -93,7 +93,6 @@ using namespace llvm; using namespace sampleprof; using namespace llvm::sampleprofutil; -using ProfileCount = Function::ProfileCount; #define DEBUG_TYPE "sample-profile" #define CSINLINE_DEBUG DEBUG_TYPE "-inline" @@ -2291,7 +2290,7 @@ bool SampleProfileLoader::runOnFunction(Function &F, // Initialize entry count when the function has no existing entry // count value. if (!F.getEntryCount()) - F.setEntryCount(ProfileCount(initialEntryCount, Function::PCT_Real)); + F.setEntryCount(initialEntryCount); auto &FAM = AM.getResult<FunctionAnalysisManagerModuleProxy>(*F.getParent()) .getManager(); ORE = &FAM.getResult<OptimizationRemarkEmitterAnalysis>(F); diff --git a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp index c48771506b73f..d9598ff7b982f 100644 --- a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp +++ b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp @@ -1581,12 +1581,12 @@ void DevirtModule::applyICallBranchFunnel(VTableSlotInfo &SlotInfo, auto EC = BFI.getBlockFreq(&F.getEntryBlock()); auto CC = F.getEntryCount(); double CallCount = 0.0; - if (EC.getFrequency() != 0 && CC && CC->getCount() != 0) { + if (EC.getFrequency() != 0 && CC && *CC != 0) { double CallFreq = static_cast<double>( BFI.getBlockFreq(CB.getParent()).getFrequency()) / EC.getFrequency(); - CallCount = CallFreq * CC->getCount(); + CallCount = CallFreq * *CC; } FunctionEntryCounts[&JT] += CallCount; } diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp index b6d07aa821e7f..4a094460d6073 100644 --- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp +++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp @@ -128,7 +128,6 @@ #include <vector> using namespace llvm; -using ProfileCount = Function::ProfileCount; using VPCandidateInfo = ValueProfileCollector::CandidateInfo; #define DEBUG_TYPE "pgo-instrumentation" @@ -1675,7 +1674,7 @@ void PGOUseFunc::populateCounters() { // Fix the obviously inconsistent entry count. if (FuncMaxCount > 0 && FuncEntryCount == 0) FuncEntryCount = 1; - F.setEntryCount(ProfileCount(FuncEntryCount, Function::PCT_Real)); + F.setEntryCount(FuncEntryCount); markFunctionAttributes(FuncEntryCount, FuncMaxCount); LLVM_DEBUG(FuncInfo.dumpInfo("after reading profile.")); @@ -1943,7 +1942,7 @@ static bool skipPGOGen(const Function &F) { return true; if (PGOInstrumentColdFunctionOnly) { if (auto EntryCount = F.getEntryCount()) - return EntryCount->getCount() > PGOColdInstrumentEntryThreshold; + return *EntryCount > PGOColdInstrumentEntryThreshold; return !PGOTreatUnknownAsCold; } return false; @@ -2031,8 +2030,7 @@ static void fixFuncEntryCount(PGOUseFunc &Func, LoopInfo &LI, BlockFrequencyInfo NBFI(F, NBPI, LI); #ifndef NDEBUG auto BFIEntryCount = F.getEntryCount(); - assert(BFIEntryCount && (BFIEntryCount->getCount() > 0) && - "Invalid BFI Entrycount"); + assert(BFIEntryCount && (*BFIEntryCount > 0) && "Invalid BFI Entrycount"); #endif auto SumCount = APFloat::getZero(APFloat::IEEEdouble()); auto SumBFICount = APFloat::getZero(APFloat::IEEEdouble()); @@ -2063,7 +2061,7 @@ static void fixFuncEntryCount(PGOUseFunc &Func, LoopInfo &LI, if (NewEntryCount == 0) NewEntryCount = 1; if (NewEntryCount != FuncEntryCount) { - F.setEntryCount(ProfileCount(NewEntryCount, Function::PCT_Real)); + F.setEntryCount(NewEntryCount); LLVM_DEBUG(dbgs() << "FixFuncEntryCount: in " << F.getName() << ", entry_count " << FuncEntryCount << " --> " << NewEntryCount << "\n"); @@ -2255,7 +2253,7 @@ static bool annotateAllFunctions( if (!Func.readCounters(AllZeros, PseudoKind)) continue; if (AllZeros) { - F.setEntryCount(ProfileCount(0, Function::PCT_Real)); + F.setEntryCount(0); if (Func.getProgramMaxCount() != 0) ColdFunctions.push_back(&F); continue; diff --git a/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp b/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp index 98ba75d1d45ae..3c38171292718 100644 --- a/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp +++ b/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp @@ -442,7 +442,7 @@ class TailRecursionEliminator { : F(F), TTI(TTI), AA(AA), ORE(ORE), DTU(DTU), BFI(BFI), OrigEntryBBFreq( BFI ? BFI->getBlockFreq(&F.getEntryBlock()).getFrequency() : 0U), - OrigEntryCount(F.getEntryCount() ? F.getEntryCount()->getCount() : 0) { + OrigEntryCount(F.getEntryCount() ? *F.getEntryCount() : 0) { if (BFI) { // The assert is meant as API documentation for the caller. assert((OrigEntryCount != 0 && OrigEntryBBFreq != 0) && @@ -771,7 +771,7 @@ bool TailRecursionEliminator::eliminateCall(CallInst *CI) { static_cast<double>(OrigEntryBBFreq); auto ToSubtract = static_cast<uint64_t>(std::round(RelativeBBFreq * OrigEntryCount)); - auto OldEntryCount = F.getEntryCount()->getCount(); + auto OldEntryCount = *F.getEntryCount(); if (OldEntryCount <= ToSubtract) { LLVM_DEBUG( errs() << "[TRE] The entrycount attributable to the recursive call, " @@ -779,7 +779,7 @@ bool TailRecu... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/204770 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
