aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
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
commitb93a23a532601edb8d4cfca4d50311087288f149 (patch)
treefbd52e2ad632a8c539311ef028a30b89e02ad3a3 /lib/Analysis
parentd0ec2352ae14acd4526ac04783e28c3280a26fb8 (diff)
downloadexternal_llvm-b93a23a532601edb8d4cfca4d50311087288f149.zip
external_llvm-b93a23a532601edb8d4cfca4d50311087288f149.tar.gz
external_llvm-b93a23a532601edb8d4cfca4d50311087288f149.tar.bz2
pull check for return inst out of loop, never inline a callee that contains
an indirectbr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85702 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/InlineCost.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Analysis/InlineCost.cpp b/lib/Analysis/InlineCost.cpp
index ee8370e..f6664ed 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<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