From 70ac2dcb841dc62f08e16f0b0e2cefbf01baa4c5 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 25 Mar 2005 00:22:36 +0000 Subject: [PATCH] Fix a bug where LICM was not updating AA information properly when sinking 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp index f8fba1b3b43..880739849ea 100644 --- a/lib/Transforms/Scalar/LICM.cpp +++ b/lib/Transforms/Scalar/LICM.cpp @@ -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);