revert 112448 for now.
authorChris Lattner <sabre@nondot.org>
Sun, 29 Aug 2010 18:11:16 +0000 (18:11 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 29 Aug 2010 18:11:16 +0000 (18:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112449 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LICM.cpp

index a214d969e9a5c77b1b8d84f384c62d02f0271f86..e6a8b2d572ea554f8be51d76fb9264303ed11409 100644 (file)
@@ -574,11 +574,12 @@ void LICM::hoist(Instruction &I) {
   DEBUG(dbgs() << "LICM hoisting to " << Preheader->getName() << ": "
         << I << "\n");
 
-  // The instruction is no longer in this loop.
-  CurAST->deleteValue(&I);
-  
-  // Move the new node to the Preheader, before its terminator.
-  I.moveBefore(Preheader->getTerminator());
+  // Remove the instruction from its current basic block... but don't delete the
+  // instruction.
+  I.removeFromParent();
+
+  // Insert the new node in Preheader, before the terminator.
+  Preheader->getInstList().insert(Preheader->getTerminator(), &I);
 
   if (isa<LoadInst>(I)) ++NumMovedLoads;
   else if (isa<CallInst>(I)) ++NumMovedCalls;