Home | History | Annotate | Download | only in IPA

Lines Matching refs:Cost

1 //===- InlineCost.cpp - Cost analysis for inliner -------------------------===//
10 // This file implements inline cost analysis.
14 #define DEBUG_TYPE "inline-cost"
55 int Cost;
75 // can cause dramatic shifts in the cost of inlining a function.
82 // The mapping of caller Alloca values to their accumulated cost savings. If
84 // cost must be added.
139 : TD(TD), TTI(TTI), F(Callee), Threshold(Threshold), Cost(0),
152 int getCost() { return Cost; }
154 // Keep a bunch of stats about the cost savings found so we can print them
175 /// \brief Lookup the SROA-candidate argument and cost iterator which V maps to.
191 /// \brief Disable SROA for the candidate marked by this cost iterator.
193 /// This marks the candidate as no longer viable for SROA, and adds the cost
194 /// savings associated with it back into the inline cost measurement.
196 // If we're no longer able to perform SROA we need to undo its cost savings
198 Cost += CostIt->second;
212 /// \brief Accumulate the given cost for a particular SROA candidate.
220 /// Either accumulates the cost savings if the SROA remains valid, or disables
312 // Phi nodes are always zero-cost.
388 // Bitcasts are always zero cost.
649 // SROA can look through these but give them a cost.
667 // SROA can look through these but give them a cost.
748 Cost += CS.arg_size() * InlineConstants::InstrCost;
750 // Everything other than inline ASM will also have a significant cost
753 Cost += InlineConstants::CallPenalty;
765 Cost += CS.arg_size() * InlineConstants::InstrCost;
780 // We were able to inline the indirect call! Subtract the cost from the
782 Cost -= std::max(0, InlineConstants::IndirectCallThreshold - CA.getCost());
803 /// \brief Analyze a basic block for its contribution to the inline cost.
806 /// block and accounts for their cost during inlining at this callsite. It
817 // If the instruction simplified to a constant, there is no cost to this
821 // cost should count against inlining.
825 Cost += InlineConstants::InstrCost;
847 if (Cost > (Threshold + VectorBonus))
895 /// viable. It computes the cost and adjusts the threshold based on numerous
896 /// factors and heuristics. If this method returns false but the computed cost
909 cost and threshold based on the direct
940 Cost -= 2 * NumStores * InlineConstants::InstrCost;
944 Cost -= InlineConstants::InstrCost;
949 // the cost of inlining it drops dramatically.
953 Cost += InlineConstants::LastCallToStaticBonus;
958 // cost.
969 Cost += InlineConstants::ColdccPenalty;
972 if (Cost > Threshold)
1022 // particular call site in order to get more accurate cost estimates. This
1034 // the cost, but only when undercounting doesn't matter.
1035 if (Cost > (Threshold + VectorBonus))
1042 // Handle the terminator cost here where we can track returns and other
1063 Cost += InlineConstants::InstrCost;
1065 // Analyze the cost of this block. If we blow through the threshold, this
1126 return Cost < Threshold;
1146 INITIALIZE_PASS_BEGIN(InlineCostAnalysis, "inline-cost", "Inline Cost Analysis",
1149 INITIALIZE_PASS_END(InlineCostAnalysis, "inline-cost", "Inline Cost Analysis",