diff --git a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp index d22fdb4d52dc..cbf4772e2778 100644 --- a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp @@ -395,9 +395,9 @@ CloneLoopBlocks(Loop *L, Value *NewIter, const bool CreateRemainderLoop, } } if (CreateRemainderLoop) { - Loop *NewLoop = NewLoops[L]; - MDNode *LoopID = NewLoop->getLoopID(); + Loop *NewLoop = NewLoops[L]; assert(NewLoop && "L should have been cloned"); + MDNode *LoopID = NewLoop->getLoopID(); // Only add loop metadata if the loop is not going to be completely // unrolled.