summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-08-29 18:18:40 +0000
committerChris Lattner <sabre@nondot.org>2010-08-29 18:18:40 +0000
commit6ac0659a1c989b6408387baa742f4fad5c69a40c (patch)
treef8ef660a8ad4b97c5095f79575c49db02d809c9a
parentf03b4eac482d0d02ee4465ad6f88a36e0bccd731 (diff)
downloadbcm5719-llvm-6ac0659a1c989b6408387baa742f4fad5c69a40c.tar.gz
bcm5719-llvm-6ac0659a1c989b6408387baa742f4fad5c69a40c.zip
use moveBefore instead of remove+insert, it avoids some
symtab manipulation, so its faster (in addition to being more elegant) llvm-svn: 112450
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index e6a8b2d572e..5f156dba725 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -474,9 +474,7 @@ void LICM::sink(Instruction &I) {
} else {
// Move the instruction to the start of the exit block, after any PHI
// nodes in it.
- I.removeFromParent();
- BasicBlock::iterator InsertPt = ExitBlocks[0]->getFirstNonPHI();
- ExitBlocks[0]->getInstList().insert(InsertPt, &I);
+ I.moveBefore(ExitBlocks[0]->getFirstNonPHI());
// This instruction is no longer in the AST for the current loop, because
// we just sunk it out of the loop. If we just sunk it into an outer
@@ -574,12 +572,8 @@ 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);
+ // 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