diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp --- a/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -486,8 +486,10 @@ // Tell ScalarEvolution that the loop is deleted. Do this before // deleting the loop so that ScalarEvolution can look at the loop // to determine what it needs to clean up. - if (SE) + if (SE) { SE->forgetLoop(L); + SE->forgetBlockAndLoopDispositions(); + } Instruction *OldTerm = Preheader->getTerminator(); assert(!OldTerm->mayHaveSideEffects() &&