forked from OSchip/llvm-project
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
This commit is contained in:
parent
1a1ed69435
commit
11f8ad8211
|
@ -574,12 +574,11 @@ void LICM::hoist(Instruction &I) {
|
||||||
DEBUG(dbgs() << "LICM hoisting to " << Preheader->getName() << ": "
|
DEBUG(dbgs() << "LICM hoisting to " << Preheader->getName() << ": "
|
||||||
<< I << "\n");
|
<< I << "\n");
|
||||||
|
|
||||||
// Remove the instruction from its current basic block... but don't delete the
|
// The instruction is no longer in this loop.
|
||||||
// instruction.
|
CurAST->deleteValue(&I);
|
||||||
I.removeFromParent();
|
|
||||||
|
|
||||||
// Insert the new node in Preheader, before the terminator.
|
// Move the new node to the Preheader, before its terminator.
|
||||||
Preheader->getInstList().insert(Preheader->getTerminator(), &I);
|
I.moveBefore(Preheader->getTerminator());
|
||||||
|
|
||||||
if (isa<LoadInst>(I)) ++NumMovedLoads;
|
if (isa<LoadInst>(I)) ++NumMovedLoads;
|
||||||
else if (isa<CallInst>(I)) ++NumMovedCalls;
|
else if (isa<CallInst>(I)) ++NumMovedCalls;
|
||||||
|
|
Loading…
Reference in New Issue