Home | History | Annotate | Download | only in Analysis

Lines Matching refs:Cost

1 //===- InlineCost.cpp - Cost analysis for inliner -------------------------===//
10 // This file implements inline cost analysis.
14 #define DEBUG_TYPE "inline-cost"
51 int Cost;
67 // can cause dramatic shifts in the cost of inlining a function.
74 // The mapping of caller Alloca values to their accumulated cost savings. If
76 // cost must be added.
127 : TD(TD), F(Callee), Threshold(Threshold), Cost(0),
140 int getCost() { return Cost; }
142 // Keep a bunch of stats about the cost savings found so we can print them
163 /// \brief Lookup the SROA-candidate argument and cost iterator which V maps to.
179 /// \brief Disable SROA for the candidate marked by this cost iterator.
181 /// This markes the candidate as no longer viable for SROA, and adds the cost
182 /// savings associated with it back into the inline cost measurement.
184 // If we're no longer able to perform SROA we need to undo its cost savings
186 Cost += CostIt->second;
200 /// \brief Accumulate the given cost for a particular SROA candidate.
208 /// Either accumulates the cost savings if the SROA remains valid, or disables
294 // Phi nodes are always zero-cost.
367 // Bitcasts are always zero cost.
448 // No-op casts don't have any cost.
651 // SROA can usually chew through these intrinsics and they have no cost
668 Cost += CS.arg_size() * InlineConstants::InstrCost;
670 // Everything other than inline ASM will also have a significant cost
673 Cost += InlineConstants::CallPenalty;
685 Cost += CS.arg_size() * InlineConstants::InstrCost;
700 // We were able to inline the indirect call! Subtract the cost from the
702 Cost -= std::max(0, InlineConstants::IndirectCallThreshold - CA.getCost());
718 /// \brief Analyze a basic block for its contribution to the inline cost.
721 /// block and accounts for their cost during inlining at this callsite. It
732 // If the instruction simplified to a constant, there is no cost to this
736 // cost should count against inlining.
740 Cost += InlineConstants::InstrCost;
755 if (!AlwaysInline && Cost > (Threshold + VectorBonus))
803 /// viable. It computes the cost and adjusts the threshold based on numerous
804 /// factors and heuristics. If this method returns false but the computed cost
817 // Unless we are always-inlining, perform some tweaks to the cost and
830 Cost -= CS.arg_size() * InlineConstants::InstrCost;
833 // the cost of inlining it drops dramatically.
835 Cost += InlineConstants::LastCallToStaticBonus;
839 // there is little point in inlining this unless there is literally zero cost.
849 Cost += InlineConstants::ColdccPenalty;
852 if (Cost > Threshold)
889 // particular call site in order to get more accurate cost estimates. This
901 // the cost, but only when undercounting doesn't matter.
902 if (!AlwaysInline && Cost > (Threshold + VectorBonus))
909 // Handle the terminator cost here where we can track returns and other
930 Cost += InlineConstants::InstrCost;
932 // Analyze the cost of this block. If we blow through the threshold, this
978 return AlwaysInline || Cost < Threshold;