[llvm-commits] [llvm] r112447 - /llvm/trunk/lib/Transforms/Scalar/LICM.cpp

Chris Lattner sabre at nondot.org
Sun Aug 29 11:00:00 PDT 2010


Author: lattner
Date: Sun Aug 29 13:00:00 2010
New Revision: 112447

URL: http://llvm.org/viewvc/llvm-project?rev=112447&view=rev
Log:
fix some bugs (found by inspection) where LICM would not update
LICM correctly.  When sinking an instruction, it should not add
entries for the sunk instruction to the AST, it should remove
the entry for the sunk instruction.  The blocks being sunk to
are not in the loop, so their instructions shouldn't be in the
AST (yet)!

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

Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=112447&r1=112446&r2=112447&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Sun Aug 29 13:00:00 2010
@@ -530,7 +530,6 @@
       New = &I;
     } else {
       New = I.clone();
-      CurAST->copyValue(&I, New);
       if (!I.getName().empty())
         New->setName(I.getName()+".le");
       ExitBlock->getInstList().insert(InsertPt, New);
@@ -563,6 +562,9 @@
   if (I.getType()->isPointerTy())
     for (unsigned i = 0, e = NewPHIs.size(); i != e; ++i)
       CurAST->copyValue(NewPHIs[i], &I);
+  
+  // Finally, remove the instruction from CurAST.  It is no longer in the loop.
+  CurAST->deleteValue(&I);
 }
 
 /// hoist - When an instruction is found to only use loop invariant operands





More information about the llvm-commits mailing list