Index: lib/Transforms/Utils/LoopUnrollPeel.cpp =================================================================== --- lib/Transforms/Utils/LoopUnrollPeel.cpp +++ lib/Transforms/Utils/LoopUnrollPeel.cpp @@ -656,9 +656,10 @@ LatchBR->setMetadata(LLVMContext::MD_prof, WeightNode); } - // If the loop is nested, we changed the parent loop, update SE. + // If the loop is nested, we could have changed any of its parent loops, + // update SE. if (Loop *ParentLoop = L->getParentLoop()) { - SE->forgetLoop(ParentLoop); + SE->forgetTopmostLoop(ParentLoop); // FIXME: Incrementally update loop-simplify simplifyLoop(ParentLoop, DT, LI, SE, AC, PreserveLCSSA);