[LoopUnroll] Fix use after poison.
llvm-svn: 314418
diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
index a7822c9..add18f3 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
@@ -1304,6 +1304,9 @@
// for unrolling is only needed to get optimization remarks emitted in
// a forward order.
Loop &L = *Worklist.pop_back_val();
+#ifndef NDEBUG
+ Loop *ParentL = L.getParentLoop();
+#endif
// The API here is quite complex to call, but there are only two interesting
// states we support: partial and full (or "simple") unrolling. However, to
@@ -1326,7 +1329,6 @@
// The parent must not be damaged by unrolling!
#ifndef NDEBUG
- Loop *ParentL = L.getParentLoop();
if (Result != LoopUnrollResult::Unmodified && ParentL)
ParentL->verifyLoop();
#endif