From bf69d033821f82e3015ff14220189fa9e3910487 Mon Sep 17 00:00:00 2001 From: Andrew Trick Date: Wed, 3 Aug 2011 18:32:11 +0000 Subject: SCEV: Use AssertingVH to catch dangling BasicBlock* when passes forget to notify SCEV of a change. Add forgetLoop in a couple of those places. llvm-svn: 136797 --- llvm/lib/Transforms/Utils/LoopSimplify.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'llvm/lib/Transforms/Utils/LoopSimplify.cpp') diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp index 9af338ec7f4..9b16c7cbe13 100644 --- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp +++ b/llvm/lib/Transforms/Utils/LoopSimplify.cpp @@ -325,6 +325,14 @@ ReprocessLoop: DEBUG(dbgs() << "LoopSimplify: Eliminating exiting block " << ExitingBlock->getName() << "\n"); + // If any reachable control flow within this loop has changed, notify + // ScalarEvolution. Currently assume the parent loop doesn't change + // (spliting edges doesn't count). If blocks, CFG edges, or other values + // in the parent loop change, then we need call to forgetLoop() for the + // parent instead. + if (SE) + SE->forgetLoop(L); + assert(pred_begin(ExitingBlock) == pred_end(ExitingBlock)); Changed = true; LI->removeBlock(ExitingBlock); -- cgit v1.2.3