[llvm-commits] [llvm] r66122 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Dale Johannesen dalej at apple.com
Wed Mar 4 18:06:48 PST 2009


Author: johannes
Date: Wed Mar  4 20:06:48 2009
New Revision: 66122

URL: http://llvm.org/viewvc/llvm-project?rev=66122&view=rev
Log:
Fix another case where debug info was affecting
codegen.  I convinced myself it was OK to skip all
pointer bitcasts here too.


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

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

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Mar  4 20:06:48 2009
@@ -11565,9 +11565,15 @@
         return Res;
 
   
-  // If this store is the last instruction in the basic block, and if the block
-  // ends with an unconditional branch, try to move it to the successor block.
-  BBI = &SI; ++BBI;
+  // If this store is the last instruction in the basic block (possibly
+  // excepting debug info instructions and the pointer bitcasts that feed
+  // into them), and if the block ends with an unconditional branch, try
+  // to move it to the successor block.
+  BBI = &SI; 
+  do {
+    ++BBI;
+  } while (isa<DbgInfoIntrinsic>(BBI) ||
+           (isa<BitCastInst>(BBI) && isa<PointerType>(BBI->getType())));
   if (BranchInst *BI = dyn_cast<BranchInst>(BBI))
     if (BI->isUnconditional())
       if (SimplifyStoreAtEndOfBlock(SI))
@@ -11625,8 +11631,15 @@
   // else' case.  there is an instruction before the branch.
   StoreInst *OtherStore = 0;
   if (OtherBr->isUnconditional()) {
-    // If this isn't a store, or isn't a store to the same location, bail out.
     --BBI;
+    // Skip over debugging info.
+    while (isa<DbgInfoIntrinsic>(BBI) ||
+           (isa<BitCastInst>(BBI) && isa<PointerType>(BBI->getType()))) {
+      if (BBI==OtherBB->begin())
+        return false;
+      --BBI;
+    }
+    // If this isn't a store, or isn't a store to the same location, bail out.
     OtherStore = dyn_cast<StoreInst>(BBI);
     if (!OtherStore || OtherStore->getOperand(1) != SI.getOperand(1))
       return false;





More information about the llvm-commits mailing list