summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/InlineCost.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-11-01 03:07:53 +0000
committerChris Lattner <sabre@nondot.org>2009-11-01 03:07:53 +0000
commit4578f8ea07c020aff5936501033d09672ac2b69e (patch)
tree4586167deeb425e80fc5ac3fbaf4244d8190d857 /llvm/lib/Analysis/InlineCost.cpp
parentc559a9f6863e4c2b394d8ed90a418ed03b57a4d1 (diff)
downloadbcm5719-llvm-4578f8ea07c020aff5936501033d09672ac2b69e.tar.gz
bcm5719-llvm-4578f8ea07c020aff5936501033d09672ac2b69e.zip
pull check for return inst out of loop, never inline a callee that contains
an indirectbr. llvm-svn: 85702
Diffstat (limited to 'llvm/lib/Analysis/InlineCost.cpp')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index ee8370ec9ca..f6664ed7888 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -146,19 +146,21 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB) {
if (CI->isLosslessCast() || isa<IntToPtrInst>(CI) ||
isa<PtrToIntInst>(CI))
continue;
- } else if (const GetElementPtrInst *GEPI =
- dyn_cast<GetElementPtrInst>(II)) {
+ } else if (const GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(II)){
// If a GEP has all constant indices, it will probably be folded with
// a load/store.
if (GEPI->hasAllConstantIndices())
continue;
}
- if (isa<ReturnInst>(II))
- ++NumRets;
-
++NumInsts;
}
+
+ if (isa<ReturnInst>(BB->getTerminator()))
+ ++NumRets;
+
+ if (isa<IndirectBrInst>(BB->getTerminator()))
+ NeverInline = true;
}
/// analyzeFunction - Fill in the current structure with information gleaned
OpenPOWER on IntegriCloud