fix some bugs (found by inspection) where LICM would not update

LICM correctly.  When sinking an instruction, it should not add
entries for the sunk instruction to the AST, it should remove
the entry for the sunk instruction.  The blocks being sunk to
are not in the loop, so their instructions shouldn't be in the
AST (yet)!

llvm-svn: 112447
This commit is contained in:
Chris Lattner 2010-08-29 18:00:00 +00:00
parent cc9cbc66a3
commit 1a1ed69435
1 changed files with 3 additions and 1 deletions

View File

@ -530,7 +530,6 @@ void LICM::sink(Instruction &I) {
New = &I;
} else {
New = I.clone();
CurAST->copyValue(&I, New);
if (!I.getName().empty())
New->setName(I.getName()+".le");
ExitBlock->getInstList().insert(InsertPt, New);
@ -563,6 +562,9 @@ void LICM::sink(Instruction &I) {
if (I.getType()->isPointerTy())
for (unsigned i = 0, e = NewPHIs.size(); i != e; ++i)
CurAST->copyValue(NewPHIs[i], &I);
// Finally, remove the instruction from CurAST. It is no longer in the loop.
CurAST->deleteValue(&I);
}
/// hoist - When an instruction is found to only use loop invariant operands