summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-08-29 18:03:33 +0000
committerChris Lattner <sabre@nondot.org>2010-08-29 18:03:33 +0000
commit11f8ad8211512b8e46bfd6c5967e32486aa0f8d3 (patch)
treeb4338e835598df614d17f98ba1a37b814f439263 /llvm/lib/Transforms
parent1a1ed69435121fe45a0ea7e4661b812c35e94713 (diff)
downloadbcm5719-llvm-11f8ad8211512b8e46bfd6c5967e32486aa0f8d3.tar.gz
bcm5719-llvm-11f8ad8211512b8e46bfd6c5967e32486aa0f8d3.zip
optimize LICM::hoist to use moveBefore. Correct its updating
of AST to remove the hoisted instruction from the AST, since it is no longer in the loop. llvm-svn: 112448
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index e6a8b2d572e..a214d969e9a 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -574,12 +574,11 @@ void LICM::hoist(Instruction &I) {
DEBUG(dbgs() << "LICM hoisting to " << Preheader->getName() << ": "
<< I << "\n");
- // 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);
+ // 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());
if (isa<LoadInst>(I)) ++NumMovedLoads;
else if (isa<CallInst>(I)) ++NumMovedCalls;
OpenPOWER on IntegriCloud