aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/InlineCost.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-01-14 21:04:31 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-01-14 21:04:31 +0000
commit1a67dd2d47f7b3c5451577ca6cd491a25584259b (patch)
treee87a7c599b260f463211c0600ced94b6b8229e8c /lib/Analysis/InlineCost.cpp
parentf4b6d88cdace335e71da7ec9b44804ffa058f37f (diff)
downloadexternal_llvm-1a67dd2d47f7b3c5451577ca6cd491a25584259b.zip
external_llvm-1a67dd2d47f7b3c5451577ca6cd491a25584259b.tar.gz
external_llvm-1a67dd2d47f7b3c5451577ca6cd491a25584259b.tar.bz2
Small tweak to inline cost computation. Ext of i/fcmp results are mostly optimized away in codegen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93453 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/InlineCost.cpp')
-rw-r--r--lib/Analysis/InlineCost.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Analysis/InlineCost.cpp b/lib/Analysis/InlineCost.cpp
index 206f4c9..87b2361 100644
--- a/lib/Analysis/InlineCost.cpp
+++ b/lib/Analysis/InlineCost.cpp
@@ -167,11 +167,16 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB) {
if (isa<ExtractElementInst>(II) || isa<VectorType>(II->getType()))
++NumVectorInsts;
- // Noop casts, including ptr <-> int, don't count.
if (const CastInst *CI = dyn_cast<CastInst>(II)) {
+ // Noop casts, including ptr <-> int, don't count.
if (CI->isLosslessCast() || isa<IntToPtrInst>(CI) ||
isa<PtrToIntInst>(CI))
continue;
+ // Result of a cmp instruction is often extended (to be used by other
+ // cmp instructions, logical or return instructions). These are usually
+ // nop on most sane targets.
+ if (isa<CmpInst>(CI->getOperand(0)))
+ continue;
} 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.