Index: include/llvm/Analysis/InlineCost.h =================================================================== --- include/llvm/Analysis/InlineCost.h +++ include/llvm/Analysis/InlineCost.h @@ -29,13 +29,13 @@ 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. Index: include/llvm/IR/Function.h =================================================================== --- include/llvm/IR/Function.h +++ include/llvm/IR/Function.h @@ -111,9 +111,10 @@ /// \brief 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 + /// \brief Returns the type of the ret val + Type *getReturnType() const; + /// \brief Returns the FunctionType for me + FunctionType *getFunctionType() const; /// getContext - Return a reference to the LLVMContext associated with this /// function. @@ -193,10 +194,12 @@ getContext(), AttributeSet::FunctionIndex, Kind)); } - /// Set the entry count for this function. + /// Set the entry count for this function - the number of times function have + /// been executed based on pgo data. void setEntryCount(uint64_t Count); - /// Get the entry count for this function. + /// Get the entry count for this function - the number of times function have + /// been executed based on pgo data. Optional getEntryCount() const; /// @brief Return true if the function has the attribute. @@ -327,7 +330,7 @@ } /// @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); } @@ -648,8 +651,8 @@ void allocHungoffUselist(); template 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); } Index: lib/Analysis/InlineCost.cpp =================================================================== --- lib/Analysis/InlineCost.cpp +++ lib/Analysis/InlineCost.cpp @@ -75,15 +75,15 @@ /// 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,28 +104,28 @@ 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 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 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 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> ConstantOffsetPtrs; - // Custom simplification helper routines. + /* Custom simplification helper routines. */ bool isAllocaDerivedArg(Value *V); bool lookupSROAArgAndCost(Value *V, Value *&Arg, DenseMap::iterator &CostIt); @@ -158,11 +158,11 @@ /// Return true if size growth is allowed when inlining the callee at CS. bool allowSizeGrowth(CallSite CS); - // Custom analysis routines. + /* Custom analysis routines. */ bool analyzeBlock(BasicBlock *BB, SmallPtrSetImpl &EphValues); - // Disable several entry points to the visitor so we don't accidentally use - // them by declaring but not defining them here. + /* Disable several entry points to the visitor so we don't accidentally use + * them by declaring but not defining them here. */ void visit(Module *); void visit(Module &); void visit(Function *); @@ -173,7 +173,7 @@ // Provide base case for our instruction visit. bool visitInstruction(Instruction &I); - // Our visit overrides. + /* Our visit overrides. */ bool visitAlloca(AllocaInst &I); bool visitPHI(PHINode &I); bool visitGetElementPtr(GetElementPtrInst &I); @@ -221,8 +221,8 @@ int getThreshold() { return Threshold; } int getCost() { return Cost; } - // Keep a bunch of stats about the cost savings found so we can print them - // out when debugging. + /* Keep a bunch of stats about the cost savings found so we can print them + * out when debugging. */ unsigned NumConstantArgs; unsigned NumConstantOffsetPtrArgs; unsigned NumAllocaArgs;