[llvm-commits] [llvm] r66288 - /llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp

Dale Johannesen dalej at apple.com
Fri Mar 6 13:08:33 PST 2009


Author: johannes
Date: Fri Mar  6 15:08:33 2009
New Revision: 66288

URL: http://llvm.org/viewvc/llvm-project?rev=66288&view=rev
Log:
Fix another case where debug info interferes with
an optimization.


Modified:
    llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp

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

==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Fri Mar  6 15:08:33 2009
@@ -385,7 +385,7 @@
       // only uses stuff defined outside of the condition.  If so, hoist it out.
       switch (I->getOpcode()) {
       default: return false;  // Cannot hoist this out safely.
-      case Instruction::Load:
+      case Instruction::Load: {
         // We can hoist loads that are non-volatile and obviously cannot trap.
         if (cast<LoadInst>(I)->isVolatile())
           return false;
@@ -397,9 +397,13 @@
         // Finally, we have to check to make sure there are no instructions
         // before the load in its basic block, as we are going to hoist the loop
         // out to its predecessor.
-        if (PBB->begin() != BasicBlock::iterator(I))
+        BasicBlock::iterator IP = PBB->begin();
+        while (isa<DbgInfoIntrinsic>(IP))
+          IP++;
+        if (IP != BasicBlock::iterator(I))
           return false;
         break;
+      }
       case Instruction::Add:
       case Instruction::Sub:
       case Instruction::And:





More information about the llvm-commits mailing list