|
LLVM 24.0.0git
|
#include "llvm/Transforms/IPO/SampleProfile.h"#include "IPOOptions.h"#include "llvm/ADT/ArrayRef.h"#include "llvm/ADT/DenseMap.h"#include "llvm/ADT/DenseSet.h"#include "llvm/ADT/MapVector.h"#include "llvm/ADT/PriorityQueue.h"#include "llvm/ADT/SCCIterator.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/Statistic.h"#include "llvm/ADT/StringRef.h"#include "llvm/ADT/Twine.h"#include "llvm/Analysis/AssumptionCache.h"#include "llvm/Analysis/BlockFrequencyInfoImpl.h"#include "llvm/Analysis/InlineAdvisor.h"#include "llvm/Analysis/InlineCost.h"#include "llvm/Analysis/LazyCallGraph.h"#include "llvm/Analysis/OptimizationRemarkEmitter.h"#include "llvm/Analysis/ProfileSummaryInfo.h"#include "llvm/Analysis/ReplayInlineAdvisor.h"#include "llvm/Analysis/TargetLibraryInfo.h"#include "llvm/Analysis/TargetTransformInfo.h"#include "llvm/IR/BasicBlock.h"#include "llvm/IR/DebugLoc.h"#include "llvm/IR/DiagnosticInfo.h"#include "llvm/IR/Function.h"#include "llvm/IR/GlobalValue.h"#include "llvm/IR/InstrTypes.h"#include "llvm/IR/Instruction.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/IntrinsicInst.h"#include "llvm/IR/LLVMContext.h"#include "llvm/IR/MDBuilder.h"#include "llvm/IR/Module.h"#include "llvm/IR/PassManager.h"#include "llvm/IR/ProfDataUtils.h"#include "llvm/IR/PseudoProbe.h"#include "llvm/IR/ValueSymbolTable.h"#include "llvm/ProfileData/InstrProf.h"#include "llvm/ProfileData/SampleProf.h"#include "llvm/ProfileData/SampleProfReader.h"#include "llvm/Support/Casting.h"#include "llvm/Support/CommandLine.h"#include "llvm/Support/Debug.h"#include "llvm/Support/ErrorOr.h"#include "llvm/Support/VirtualFileSystem.h"#include "llvm/Support/raw_ostream.h"#include "llvm/Transforms/IPO.h"#include "llvm/Transforms/IPO/ProfiledCallGraph.h"#include "llvm/Transforms/IPO/SampleContextTracker.h"#include "llvm/Transforms/IPO/SampleProfileMatcher.h"#include "llvm/Transforms/IPO/SampleProfileProbe.h"#include "llvm/Transforms/Utils/CallPromotionUtils.h"#include "llvm/Transforms/Utils/Cloning.h"#include "llvm/Transforms/Utils/Instrumentation.h"#include "llvm/Transforms/Utils/MisExpect.h"#include "llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h"#include "llvm/Transforms/Utils/SampleProfileLoaderBaseUtil.h"#include <algorithm>#include <cassert>#include <cstdint>#include <functional>#include <limits>#include <memory>#include <queue>#include <string>#include <system_error>#include <utility>#include <vector>Go to the source code of this file.
Namespaces | |
| namespace | llvm |
| This is an optimization pass for GlobalISel generic memory operations. | |
Macros | |
| #define | DEBUG_TYPE "sample-profile" |
| #define | CSINLINE_DEBUG DEBUG_TYPE "-inline" |
Functions | |
| STATISTIC (NumCSInlined, "Number of functions inlined with context sensitive profile") | |
| STATISTIC (NumCSNotInlined, "Number of functions not inlined with context sensitive profile") | |
| STATISTIC (NumMismatchedProfile, "Number of functions with CFG mismatched profile") | |
| STATISTIC (NumMatchedProfile, "Number of functions with CFG matched profile") | |
| STATISTIC (NumDuplicatedInlinesite, "Number of inlined callsites with a partial distribution factor") | |
| STATISTIC (NumCSInlinedHitMinLimit, "Number of functions with FDO inline stopped due to min size limit") | |
| STATISTIC (NumCSInlinedHitMaxLimit, "Number of functions with FDO inline stopped due to max size limit") | |
| STATISTIC (NumCSInlinedHitGrowthLimit, "Number of functions with FDO inline stopped due to growth size limit") | |
| cl::opt< bool > | llvm::SortProfiledSCC ("sort-profiled-scc-member", cl::init(true), cl::Hidden, cl::desc("Sort profiled recursion by edge weights.")) |
| cl::opt< int > | llvm::ProfileInlineGrowthLimit ("sample-profile-inline-growth-limit", cl::Hidden, cl::init(12), cl::desc("The size growth ratio limit for priority-based sample profile " "loader inlining.")) |
| cl::opt< int > | llvm::ProfileInlineLimitMin ("sample-profile-inline-limit-min", cl::Hidden, cl::init(100), cl::desc("The lower bound of size growth limit for " "priority-based sample profile loader inlining.")) |
| cl::opt< int > | llvm::ProfileInlineLimitMax ("sample-profile-inline-limit-max", cl::Hidden, cl::init(10000), cl::desc("The upper bound of size growth limit for " "priority-based sample profile loader inlining.")) |
| cl::opt< int > | llvm::SampleHotCallSiteThreshold ("sample-profile-hot-inline-threshold", cl::Hidden, cl::init(3000), cl::desc("Hot callsite threshold for priority-based sample profile loader " "inlining.")) |
| cl::opt< int > | llvm::SampleColdCallSiteThreshold ("sample-profile-cold-inline-threshold", cl::Hidden, cl::init(45), cl::desc("Threshold for inlining cold callsites")) |
| static bool | doesHistoryAllowICP (const IPOOptions &Opts, const Instruction &Inst, StringRef Candidate) |
Check whether the indirect call promotion history of Inst allows the promotion for Candidate. | |
| static void | updateIDTMetaData (const IPOOptions &Opts, Instruction &Inst, const SmallVectorImpl< InstrProfValueData > &CallTargets, uint64_t Sum) |
Update indirect call target profile metadata for Inst. | |
| static SmallVector< InstrProfValueData, 2 > | GetSortedValueDataFromCallTargets (const SampleRecord::CallTargetMap &M) |
Returns the sorted CallTargetMap M by count in descending order. | |
| #define CSINLINE_DEBUG DEBUG_TYPE "-inline" |
Definition at line 98 of file SampleProfile.cpp.
| #define DEBUG_TYPE "sample-profile" |
Definition at line 97 of file SampleProfile.cpp.
|
static |
Check whether the indirect call promotion history of Inst allows the promotion for Candidate.
If the profile count for the promotion candidate Candidate is NOMORE_ICP_MAGICNUM, it means Candidate has already been promoted for Inst. If we already have at least MaxNumPromotions NOMORE_ICP_MAGICNUM count values in the value profile of Inst, we cannot promote for Inst anymore.
Definition at line 626 of file SampleProfile.cpp.
References llvm::GlobalValue::getGUIDAssumingExternalLinkage(), llvm::getValueProfDataFromInst(), llvm::NOMORE_ICP_MAGICNUM, uint64_t, and V.
|
static |
Returns the sorted CallTargetMap M by count in descending order.
Definition at line 1424 of file SampleProfile.cpp.
References I, and llvm::sampleprof::SampleRecord::sortCallTargets().
| STATISTIC | ( | NumCSInlined | , |
| "Number of functions inlined with context sensitive profile" | ) |
| STATISTIC | ( | NumCSInlinedHitGrowthLimit | , |
| "Number of functions with FDO inline stopped due to growth size limit" | ) |
| STATISTIC | ( | NumCSInlinedHitMaxLimit | , |
| "Number of functions with FDO inline stopped due to max size limit" | ) |
| STATISTIC | ( | NumCSInlinedHitMinLimit | , |
| "Number of functions with FDO inline stopped due to min size limit" | ) |
| STATISTIC | ( | NumCSNotInlined | , |
| "Number of functions not inlined with context sensitive profile" | ) |
| STATISTIC | ( | NumDuplicatedInlinesite | , |
| "Number of inlined callsites with a partial distribution factor" | ) |
|
static |
Update indirect call target profile metadata for Inst.
Usually Sum is the sum of counts of all the targets for Inst. If it is 0, it means updateIDTMetaData is used to mark a certain target to be promoted already. If it is not zero, we expect to use it to update the total count in the value profile.
Definition at line 661 of file SampleProfile.cpp.
References llvm::annotateValueSite(), assert(), llvm::Count, llvm::Data, llvm::SmallVectorImpl< T >::emplace_back(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::getValueProfDataFromInst(), llvm::NOMORE_ICP_MAGICNUM, llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::sort(), llvm::DenseMapBase< StorageT, KeyT, ValueT, KeyInfoT, BucketT >::try_emplace(), uint64_t, and V.