summaryrefslogtreecommitdiffstats
path: root/llvm
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
commit8e670ee3819ffadefc86885cdc8d27a3719c9dd4 (patch)
tree65c8c8ec811618eefc4493ae8098e9f1d0cfdfcc /llvm
parent0b534d5969a573c0e48d335a717b3181d95deb99 (diff)
downloadbcm5719-llvm-8e670ee3819ffadefc86885cdc8d27a3719c9dd4.tar.gz
bcm5719-llvm-8e670ee3819ffadefc86885cdc8d27a3719c9dd4.zip
Small tweak to inline cost computation. Ext of i/fcmp results are mostly optimized away in codegen.
llvm-svn: 93453
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 206f4c968a6..87b2361db6a 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/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.
OpenPOWER on IntegriCloud