[llvm-commits] [llvm] r65999 - in /llvm/trunk/lib/Transforms: Scalar/InstructionCombining.cpp Utils/InlineFunction.cpp

Dale Johannesen dalej at apple.com
Tue Mar 3 17:53:05 PST 2009


Author: johannes
Date: Tue Mar  3 19:53:05 2009
New Revision: 65999

URL: http://llvm.org/viewvc/llvm-project?rev=65999&view=rev
Log:
Always skip ptr-to-ptr bitcasts when counting,
per Chris' suggestion.  Slightly faster.


Modified:
    llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
    llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=65999&r1=65998&r2=65999&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue Mar  3 19:53:05 2009
@@ -11484,12 +11484,12 @@
   for (unsigned ScanInsts = 6; BBI != SI.getParent()->begin() && ScanInsts;
        --ScanInsts) {
     --BBI;
-    // Don't count debug info directives, lest they affect codegen.
-    // Likewise, we skip bitcasts that feed into a llvm.dbg.declare; these are
-    // not present when debugging is off.
+    // Don't count debug info directives, lest they affect codegen,
+    // and we skip pointer-to-pointer bitcasts, which are NOPs.
+    // It is necessary for correctness to skip those that feed into a
+    // llvm.dbg.declare, as these are not present when debugging is off.
     if (isa<DbgInfoIntrinsic>(BBI) ||
-        (isa<BitCastInst>(BBI) && BBI->hasOneUse() &&
-         isa<DbgDeclareInst>(BBI->use_begin()))) {
+        (isa<BitCastInst>(BBI) && isa<PointerType>(BBI->getType()))) {
       ScanInsts++;
       continue;
     }    

Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=65999&r1=65998&r2=65999&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Tue Mar  3 19:53:05 2009
@@ -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()) {





More information about the llvm-commits mailing list