diff --git a/lib/Analysis/InlineCost.cpp b/lib/Analysis/InlineCost.cpp index 206f4c968a6..87b2361db6a 100644 --- a/lib/Analysis/InlineCost.cpp +++ b/lib/Analysis/InlineCost.cpp @@ -167,11 +167,16 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB) { if (isa(II) || isa(II->getType())) ++NumVectorInsts; - // Noop casts, including ptr <-> int, don't count. if (const CastInst *CI = dyn_cast(II)) { + // Noop casts, including ptr <-> int, don't count. if (CI->isLosslessCast() || isa(CI) || isa(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(CI->getOperand(0))) + continue; } else if (const GetElementPtrInst *GEPI = dyn_cast(II)){ // If a GEP has all constant indices, it will probably be folded with // a load/store.