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

Chris Lattner sabre at nondot.org
Sat Oct 31 20:07:53 PDT 2009


Author: lattner
Date: Sat Oct 31 22:07:53 2009
New Revision: 85702

URL: http://llvm.org/viewvc/llvm-project?rev=85702&view=rev
Log:
pull check for return inst out of loop, never inline a callee that contains
an indirectbr.

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=85702&r1=85701&r2=85702&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/InlineCost.cpp (original)
+++ llvm/trunk/lib/Analysis/InlineCost.cpp Sat Oct 31 22:07:53 2009
@@ -146,19 +146,21 @@
       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





More information about the llvm-commits mailing list