diff --git a/lib/Analysis/InlineCost.cpp b/lib/Analysis/InlineCost.cpp index ee8370ec9ca..f6664ed7888 100644 --- a/lib/Analysis/InlineCost.cpp +++ b/lib/Analysis/InlineCost.cpp @@ -146,19 +146,21 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB) { if (CI->isLosslessCast() || isa(CI) || isa(CI)) continue; - } else if (const GetElementPtrInst *GEPI = - dyn_cast(II)) { + } else if (const GetElementPtrInst *GEPI = dyn_cast(II)){ // If a GEP has all constant indices, it will probably be folded with // a load/store. if (GEPI->hasAllConstantIndices()) continue; } - if (isa(II)) - ++NumRets; - ++NumInsts; } + + if (isa(BB->getTerminator())) + ++NumRets; + + if (isa(BB->getTerminator())) + NeverInline = true; } /// analyzeFunction - Fill in the current structure with information gleaned