aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-08-29 18:00:00 +0000
committerChris Lattner <sabre@nondot.org>2010-08-29 18:00:00 +0000
commit98917503c702e16f35ccdec3f6b4c48e5c4759ac (patch)
tree3e468cc12cb1541a3b1758a96ab8da5b88edd7f1 /lib/Transforms
parent4282e32712da220fd97177772e22ec1ee7e50af2 (diff)
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)! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112447 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/LICM.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp
index 44dfed8ed4..e6a8b2d572 100644
--- a/lib/Transforms/Scalar/LICM.cpp
+++ b/lib/Transforms/Scalar/LICM.cpp
@@ -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