[llvm-commits] [llvm] r93453 - /llvm/trunk/lib/Analysis/InlineCost.cpp

Evan Cheng evan.cheng at apple.com
Thu Jan 14 13:04:31 PST 2010


Author: evancheng
Date: Thu Jan 14 15:04:31 2010
New Revision: 93453

URL: http://llvm.org/viewvc/llvm-project?rev=93453&view=rev
Log:
Small tweak to inline cost computation. Ext of i/fcmp results are mostly optimized away in codegen.

Modified:
    llvm/trunk/lib/Analysis/InlineCost.cpp

Modified: llvm/trunk/lib/Analysis/InlineCost.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InlineCost.cpp?rev=93453&r1=93452&r2=93453&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/InlineCost.cpp (original)
+++ llvm/trunk/lib/Analysis/InlineCost.cpp Thu Jan 14 15:04:31 2010
@@ -167,11 +167,16 @@
     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.





More information about the llvm-commits mailing list