summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit1a1ed69435121fe45a0ea7e4661b812c35e94713 (patch)
tree9d925cb37368306c71fb9fd6047444b163430cb1 /llvm/lib/Transforms
parentcc9cbc66a3c232c7c8e01fd128c7991cd97d249e (diff)
downloadbcm5719-llvm-1a1ed69435121fe45a0ea7e4661b812c35e94713.tar.gz
bcm5719-llvm-1a1ed69435121fe45a0ea7e4661b812c35e94713.zip
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
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 44dfed8ed4e..e6a8b2d572e 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud