forked from OSchip/llvm-project
parent
6237a21d8c
commit
f3d122cd02
|
@ -29,13 +29,13 @@ class TargetTransformInfo;
|
|||
|
||||
namespace InlineConstants {
|
||||
// Various thresholds used by inline cost analysis.
|
||||
// Use when optsize (-Os) is specified.
|
||||
/// Use when optsize (-Os) is specified.
|
||||
const int OptSizeThreshold = 75;
|
||||
|
||||
// Use when minsize (-Oz) is specified.
|
||||
/// Use when minsize (-Oz) is specified.
|
||||
const int OptMinSizeThreshold = 25;
|
||||
|
||||
// Use when -O3 is specified.
|
||||
/// Use when -O3 is specified.
|
||||
const int OptAggressiveThreshold = 275;
|
||||
|
||||
// Various magic constants used to adjust heuristics.
|
||||
|
|
|
@ -110,11 +110,12 @@ public:
|
|||
|
||||
~Function() override;
|
||||
|
||||
/// \brief Provide fast operand accessors
|
||||
// Provide fast operand accessors.
|
||||
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
|
||||
|
||||
Type *getReturnType() const; // Return the type of the ret val
|
||||
FunctionType *getFunctionType() const; // Return the FunctionType for me
|
||||
/// Returns the type of the ret val.
|
||||
Type *getReturnType() const;
|
||||
/// Returns the FunctionType for me.
|
||||
FunctionType *getFunctionType() const;
|
||||
|
||||
/// getContext - Return a reference to the LLVMContext associated with this
|
||||
/// function.
|
||||
|
@ -190,10 +191,16 @@ public:
|
|||
getContext(), AttributeSet::FunctionIndex, Kind));
|
||||
}
|
||||
|
||||
/// Set the entry count for this function.
|
||||
/// \brief Set the entry count for this function.
|
||||
///
|
||||
/// Entry count is the number of times this function was executed based on
|
||||
/// pgo data.
|
||||
void setEntryCount(uint64_t Count);
|
||||
|
||||
/// Get the entry count for this function.
|
||||
/// \brief Get the entry count for this function.
|
||||
///
|
||||
/// Entry count is the number of times the function was executed based on
|
||||
/// pgo data.
|
||||
Optional<uint64_t> getEntryCount() const;
|
||||
|
||||
/// @brief Return true if the function has the attribute.
|
||||
|
@ -324,7 +331,7 @@ public:
|
|||
}
|
||||
|
||||
/// @brief Determine if the function may only access memory that is
|
||||
// either inaccessible from the IR or pointed to by its arguments.
|
||||
/// either inaccessible from the IR or pointed to by its arguments.
|
||||
bool onlyAccessesInaccessibleMemOrArgMem() const {
|
||||
return hasFnAttribute(Attribute::InaccessibleMemOrArgMemOnly);
|
||||
}
|
||||
|
@ -647,8 +654,8 @@ private:
|
|||
void allocHungoffUselist();
|
||||
template<int Idx> void setHungoffOperand(Constant *C);
|
||||
|
||||
// Shadow Value::setValueSubclassData with a private forwarding method so that
|
||||
// subclasses cannot accidentally use it.
|
||||
/// Shadow Value::setValueSubclassData with a private forwarding method so
|
||||
/// that subclasses cannot accidentally use it.
|
||||
void setValueSubclassData(unsigned short D) {
|
||||
Value::setValueSubclassData(D);
|
||||
}
|
||||
|
|
|
@ -75,15 +75,15 @@ class CallAnalyzer : public InstVisitor<CallAnalyzer, bool> {
|
|||
/// Profile summary information.
|
||||
ProfileSummaryInfo *PSI;
|
||||
|
||||
// The called function.
|
||||
/// The called function.
|
||||
Function &F;
|
||||
|
||||
// The candidate callsite being analyzed. Please do not use this to do
|
||||
// analysis in the caller function; we want the inline cost query to be
|
||||
// easily cacheable. Instead, use the cover function paramHasAttr.
|
||||
/// The candidate callsite being analyzed. Please do not use this to do
|
||||
/// analysis in the caller function; we want the inline cost query to be
|
||||
/// easily cacheable. Instead, use the cover function paramHasAttr.
|
||||
CallSite CandidateCS;
|
||||
|
||||
// Tunable parameters that control the analysis.
|
||||
/// Tunable parameters that control the analysis.
|
||||
const InlineParams &Params;
|
||||
|
||||
int Threshold;
|
||||
|
@ -104,25 +104,25 @@ class CallAnalyzer : public InstVisitor<CallAnalyzer, bool> {
|
|||
int FiftyPercentVectorBonus, TenPercentVectorBonus;
|
||||
int VectorBonus;
|
||||
|
||||
// While we walk the potentially-inlined instructions, we build up and
|
||||
// maintain a mapping of simplified values specific to this callsite. The
|
||||
// idea is to propagate any special information we have about arguments to
|
||||
// this call through the inlinable section of the function, and account for
|
||||
// likely simplifications post-inlining. The most important aspect we track
|
||||
// is CFG altering simplifications -- when we prove a basic block dead, that
|
||||
// can cause dramatic shifts in the cost of inlining a function.
|
||||
/// While we walk the potentially-inlined instructions, we build up and
|
||||
/// maintain a mapping of simplified values specific to this callsite. The
|
||||
/// idea is to propagate any special information we have about arguments to
|
||||
/// this call through the inlinable section of the function, and account for
|
||||
/// likely simplifications post-inlining. The most important aspect we track
|
||||
/// is CFG altering simplifications -- when we prove a basic block dead, that
|
||||
/// can cause dramatic shifts in the cost of inlining a function.
|
||||
DenseMap<Value *, Constant *> SimplifiedValues;
|
||||
|
||||
// Keep track of the values which map back (through function arguments) to
|
||||
// allocas on the caller stack which could be simplified through SROA.
|
||||
/// Keep track of the values which map back (through function arguments) to
|
||||
/// allocas on the caller stack which could be simplified through SROA.
|
||||
DenseMap<Value *, Value *> SROAArgValues;
|
||||
|
||||
// The mapping of caller Alloca values to their accumulated cost savings. If
|
||||
// we have to disable SROA for one of the allocas, this tells us how much
|
||||
// cost must be added.
|
||||
/// The mapping of caller Alloca values to their accumulated cost savings. If
|
||||
/// we have to disable SROA for one of the allocas, this tells us how much
|
||||
/// cost must be added.
|
||||
DenseMap<Value *, int> SROAArgCosts;
|
||||
|
||||
// Keep track of values which map to a pointer base and constant offset.
|
||||
/// Keep track of values which map to a pointer base and constant offset.
|
||||
DenseMap<Value *, std::pair<Value *, APInt>> ConstantOffsetPtrs;
|
||||
|
||||
// Custom simplification helper routines.
|
||||
|
|
|
@ -63,9 +63,9 @@ void ProfileSummaryInfo::computeSummary() {
|
|||
Summary.reset(ProfileSummary::getFromMD(SummaryMD));
|
||||
}
|
||||
|
||||
// Returns true if the function is a hot function. If it returns false, it
|
||||
// either means it is not hot or it is unknown whether F is hot or not (for
|
||||
// example, no profile data is available).
|
||||
/// Returns true if the function is a hot function. If it returns false, it
|
||||
/// either means it is not hot or it is unknown whether F is hot or not (for
|
||||
/// example, no profile data is available).
|
||||
bool ProfileSummaryInfo::isHotFunction(const Function *F) {
|
||||
computeSummary();
|
||||
if (!F || !Summary)
|
||||
|
@ -79,9 +79,9 @@ bool ProfileSummaryInfo::isHotFunction(const Function *F) {
|
|||
(uint64_t)(0.3 * (double)Summary->getMaxFunctionCount()));
|
||||
}
|
||||
|
||||
// Returns true if the function is a cold function. If it returns false, it
|
||||
// either means it is not cold or it is unknown whether F is cold or not (for
|
||||
// example, no profile data is available).
|
||||
/// Returns true if the function is a cold function. If it returns false, it
|
||||
/// either means it is not cold or it is unknown whether F is cold or not (for
|
||||
/// example, no profile data is available).
|
||||
bool ProfileSummaryInfo::isColdFunction(const Function *F) {
|
||||
computeSummary();
|
||||
if (!F)
|
||||
|
@ -100,7 +100,7 @@ bool ProfileSummaryInfo::isColdFunction(const Function *F) {
|
|||
(uint64_t)(0.01 * (double)Summary->getMaxFunctionCount()));
|
||||
}
|
||||
|
||||
// Compute the hot and cold thresholds.
|
||||
/// Compute the hot and cold thresholds.
|
||||
void ProfileSummaryInfo::computeThresholds() {
|
||||
if (!Summary)
|
||||
computeSummary();
|
||||
|
|
Loading…
Reference in New Issue