mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-03 17:24:24 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112448 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
98917503c7
commit
bb07ed3bb5
@ -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();
|
|
||||||
|
// Move the new node to the Preheader, before its terminator.
|
||||||
// Insert the new node in Preheader, before the terminator.
|
I.moveBefore(Preheader->getTerminator());
|
||||||
Preheader->getInstList().insert(Preheader->getTerminator(), &I);
|
|
||||||
|
|
||||||
if (isa<LoadInst>(I)) ++NumMovedLoads;
|
if (isa<LoadInst>(I)) ++NumMovedLoads;
|
||||||
else if (isa<CallInst>(I)) ++NumMovedCalls;
|
else if (isa<CallInst>(I)) ++NumMovedCalls;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user