Always skip ptr-to-ptr bitcasts when counting,
per Chris' suggestion.  Slightly faster.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65999 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp
index a96c7ce..9cd38cc 100644
--- a/lib/Transforms/Utils/InlineFunction.cpp
+++ b/lib/Transforms/Utils/InlineFunction.cpp
@@ -235,7 +235,7 @@
   // function.
   std::vector<ReturnInst*> Returns;
   ClonedCodeInfo InlinedFunctionInfo;
-  Function::iterator FirstNewBlock;
+  Function::iterator FirstNewBlock, LastNewBlock;
 
   { // Scope to destroy ValueMap after cloning.
     DenseMap<const Value*, Value*> ValueMap;
@@ -312,6 +312,7 @@
 
     // Remember the first block that is newly cloned over.
     FirstNewBlock = LastBlock; ++FirstNewBlock;
+    LastNewBlock = &Caller->back();
 
     // Update the callgraph if requested.
     if (CG)
@@ -537,7 +538,9 @@
     // Add a branch to the merge points and remove return instructions.
     for (unsigned i = 0, e = Returns.size(); i != e; ++i) {
       ReturnInst *RI = Returns[i];
-      BranchInst::Create(AfterCallBB, RI);
+      // A return in the last block in the function falls through.
+//      if (isa<InvokeInst>(TheCall) || RI->getParent() != LastNewBlock)
+        BranchInst::Create(AfterCallBB, RI);
       RI->eraseFromParent();
     }
   } else if (!Returns.empty()) {