From f03b4eac482d0d02ee4465ad6f88a36e0bccd731 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 29 Aug 2010 18:11:16 +0000 Subject: [PATCH] revert 112448 for now. llvm-svn: 112449 --- llvm/lib/Transforms/Scalar/LICM.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index a214d969e9a5..e6a8b2d572ea 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -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(I)) ++NumMovedLoads; else if (isa(I)) ++NumMovedCalls;