From 6adbd7aecf5182ee5d7b50a3547c89de1483b7e3 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Fri, 6 Mar 2015 10:39:14 +0000 Subject: [PATCH] Change the way in which error case is being handled. Specifically this: * Prevents an "unused" warning in non-assert builds. * In that error case return with out removing a child loop instead of looping forever. llvm-svn: 231459 --- llvm/lib/Transforms/Scalar/LoopInterchange.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp index 6ded56e..f8c865b 100644 --- a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp +++ b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp @@ -901,14 +901,16 @@ bool LoopInterchangeProfitability::isProfitable(unsigned InnerLoopId, void LoopInterchangeTransform::removeChildLoop(Loop *OuterLoop, Loop *InnerLoop) { - for (Loop::iterator I = OuterLoop->begin(), E = OuterLoop->end();; ++I) { - assert(I != E && "Couldn't find loop"); + for (Loop::iterator I = OuterLoop->begin(), E = OuterLoop->end(); I != E; + ++I) { if (*I == InnerLoop) { OuterLoop->removeChildLoop(I); return; } } + assert(false && "Couldn't find loop"); } + void LoopInterchangeTransform::restructureLoops(Loop *InnerLoop, Loop *OuterLoop) { Loop *OuterLoopParent = OuterLoop->getParentLoop(); -- 2.7.4