llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-llvm-analysis Author: Aiden Grossman (boomanaiden154) <details> <summary>Changes</summary> Now that synthetic entry counts are being removed, stop using the ProfileCount wrapper around entrycounts given it only exists to distinguish between synthetic and real profile counts. --- Full diff: https://github.com/llvm/llvm-project/pull/204769.diff 2 Files Affected: - (modified) llvm/include/llvm/Analysis/ProfileSummaryInfo.h (+11-12) - (modified) llvm/lib/CodeGen/MachineFunction.cpp (+4-2) ``````````diff diff --git a/llvm/include/llvm/Analysis/ProfileSummaryInfo.h b/llvm/include/llvm/Analysis/ProfileSummaryInfo.h index 7038b4efebf2e..547bc344d314b 100644 --- a/llvm/include/llvm/Analysis/ProfileSummaryInfo.h +++ b/llvm/include/llvm/Analysis/ProfileSummaryInfo.h @@ -115,11 +115,11 @@ class ProfileSummaryInfo { template <typename FuncT> bool isFunctionEntryHot(const FuncT *F) const { if (!F || !hasProfileSummary()) return false; - std::optional<Function::ProfileCount> FunctionCount = getEntryCount(F); + std::optional<uint64_t> FunctionCount = getEntryCount(F); // FIXME: The heuristic used below for determining hotness is based on // preliminary SPEC tuning for inliner. This will eventually be a // convenience method that calls isHotCount. - return FunctionCount && isHotCount(FunctionCount->getCount()); + return FunctionCount && isHotCount(*FunctionCount); } /// Returns true if \p F contains hot code. @@ -128,7 +128,7 @@ class ProfileSummaryInfo { if (!F || !hasProfileSummary()) return false; if (auto FunctionCount = getEntryCount(F)) - if (isHotCount(FunctionCount->getCount())) + if (isHotCount(*FunctionCount)) return true; if (auto TotalCallCount = getTotalCallCount(F)) @@ -148,7 +148,7 @@ class ProfileSummaryInfo { if (!F || !hasProfileSummary()) return false; if (auto FunctionCount = getEntryCount(F)) - if (!isColdCount(FunctionCount->getCount())) + if (!isColdCount(*FunctionCount)) return false; if (auto TotalCallCount = getTotalCallCount(F)) @@ -278,11 +278,9 @@ class ProfileSummaryInfo { if (!F || !hasProfileSummary()) return false; if (auto FunctionCount = getEntryCount(F)) { - if (isHot && - isHotCountNthPercentile(PercentileCutoff, FunctionCount->getCount())) + if (isHot && isHotCountNthPercentile(PercentileCutoff, *FunctionCount)) return true; - if (!isHot && !isColdCountNthPercentile(PercentileCutoff, - FunctionCount->getCount())) + if (!isHot && !isColdCountNthPercentile(PercentileCutoff, *FunctionCount)) return false; } if (auto TotalCallCount = getTotalCallCount(F)) { @@ -326,8 +324,10 @@ class ProfileSummaryInfo { } template <typename FuncT> - std::optional<Function::ProfileCount> getEntryCount(const FuncT *F) const { - return F->getEntryCount(); + std::optional<uint64_t> getEntryCount(const FuncT *F) const { + if (!F->getEntryCount().has_value()) + return std::nullopt; + return F->getEntryCount()->getCount(); } }; @@ -349,8 +349,7 @@ ProfileSummaryInfo::getTotalCallCount<Function>(const Function *F) const { // here, because we cannot include MachineFunction header here, that would break // dependency rules. template <> -std::optional<Function::ProfileCount> -ProfileSummaryInfo::getEntryCount<MachineFunction>( +std::optional<uint64_t> ProfileSummaryInfo::getEntryCount<MachineFunction>( const MachineFunction *F) const; /// An analysis pass based on legacy pass manager to deliver ProfileSummaryInfo. diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index 2922922535333..8246b77ac9dce 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -1666,10 +1666,12 @@ void MachineConstantPool::print(raw_ostream &OS) const { // ProfileSummaryInfo::getEntryCount(). //===----------------------------------------------------------------------===// template <> -std::optional<Function::ProfileCount> +std::optional<uint64_t> ProfileSummaryInfo::getEntryCount<llvm::MachineFunction>( const llvm::MachineFunction *F) const { - return F->getFunction().getEntryCount(); + if (!F->getFunction().getEntryCount().has_value()) + return std::nullopt; + return F->getFunction().getEntryCount()->getCount(); } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) `````````` </details> https://github.com/llvm/llvm-project/pull/204769 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
