Fix a bug where LICM was not updating AA information properly when sinking
authorChris Lattner <sabre@nondot.org>
Fri, 25 Mar 2005 00:22:36 +0000 (00:22 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 25 Mar 2005 00:22:36 +0000 (00:22 +0000)
a pointer value out of a loop causing it to be duplicated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20828 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LICM.cpp

index f8fba1b3b432f0653d27cb324837c029113f3fde..880739849eaad68b961388fd86190046fa17cd53 100644 (file)
@@ -302,7 +302,7 @@ void LICM::SinkRegion(DominatorTree::Node *N) {
     // outside of the loop.  In this case, it doesn't even matter if the
     // operands of the instruction are loop invariant.
     //
-    if (canSinkOrHoistInst(I) && isNotUsedInLoop(I)) {
+    if (isNotUsedInLoop(I) && canSinkOrHoistInst(I)) {
       ++II;
       sink(I);
     }
@@ -530,6 +530,7 @@ 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);