aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-08-29 18:11:16 +0000
committerChris Lattner <sabre@nondot.org>2010-08-29 18:11:16 +0000
commit1b9c848d0a680de2aed44f43c85f4594416ff15a (patch)
tree3e468cc12cb1541a3b1758a96ab8da5b88edd7f1 /lib/Transforms
parentbb07ed3bb5db1b610362628ceb31349667c491c2 (diff)
revert 112448 for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112449 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/LICM.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp
index a214d969e9..e6a8b2d572 100644
--- a/lib/Transforms/Scalar/LICM.cpp
+++ b/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<LoadInst>(I)) ++NumMovedLoads;
else if (isa<CallInst>(I)) ++NumMovedCalls;