[llvm-commits] [llvm] r112448 - /llvm/trunk/lib/Transforms/Scalar/LICM.cpp
Chris Lattner
sabre at nondot.org
Sun Aug 29 11:03:33 PDT 2010
Author: lattner
Date: Sun Aug 29 13:03:33 2010
New Revision: 112448
URL: http://llvm.org/viewvc/llvm-project?rev=112448&view=rev
Log:
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.
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=112448&r1=112447&r2=112448&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Sun Aug 29 13:03:33 2010
@@ -574,12 +574,11 @@
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;
More information about the llvm-commits
mailing list