From f8104c5132b84dfad0591ad78a6cdf8fb01e0519 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Sun, 27 Jan 2008 18:35:00 +0000 Subject: Be more careful modifying the use_list while also iterating through it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46417 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LoopUnroll.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/Transforms/Scalar/LoopUnroll.cpp b/lib/Transforms/Scalar/LoopUnroll.cpp index ff2168a..b514156 100644 --- a/lib/Transforms/Scalar/LoopUnroll.cpp +++ b/lib/Transforms/Scalar/LoopUnroll.cpp @@ -365,8 +365,9 @@ bool LoopUnroll::unrollLoop(Loop *L, unsigned Count, unsigned Threshold) { // be updated specially after unrolling all the way. if (*BB != LatchBlock) for (Value::use_iterator UI = (*BB)->use_begin(), UE = (*BB)->use_end(); - UI != UE; ++UI) { + UI != UE;) { Instruction *UseInst = cast(*UI); + ++UI; if (isa(UseInst) && !L->contains(UseInst->getParent())) { PHINode *phi = cast(UseInst); Value *Incoming = phi->getIncomingValueForBlock(*BB); -- cgit v1.1