Index: lib/Analysis/InlineCost.cpp =================================================================== --- lib/Analysis/InlineCost.cpp +++ lib/Analysis/InlineCost.cpp @@ -1206,7 +1206,7 @@ std::min((int64_t)CostUpperBound, (int64_t)SI.getNumCases() * InlineConstants::InstrCost + Cost); - if (CostLowerBound > Threshold && !ComputeFullInlineCost) { + if (CostLowerBound >= Threshold && !ComputeFullInlineCost) { Cost = CostLowerBound; return false; } @@ -1384,7 +1384,7 @@ // Check if we've past the maximum possible threshold so we don't spin in // huge basic blocks that will never inline. - if (Cost > Threshold && !ComputeFullInlineCost) + if (Cost >= Threshold && !ComputeFullInlineCost) return false; } @@ -1470,7 +1470,7 @@ Cost += InlineConstants::ColdccPenalty; // Check if we're done. This can happen due to bonuses and penalties. - if (Cost > Threshold && !ComputeFullInlineCost) + if (Cost >= Threshold && !ComputeFullInlineCost) return false; if (F.empty()) @@ -1536,7 +1536,7 @@ for (unsigned Idx = 0; Idx != BBWorklist.size(); ++Idx) { // Bail out the moment we cross the threshold. This means we'll under-count // the cost, but only when undercounting doesn't matter. - if (Cost > Threshold && !ComputeFullInlineCost) + if (Cost >= Threshold && !ComputeFullInlineCost) break; BasicBlock *BB = BBWorklist[Idx];