summaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/LoopUnroll.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2008-01-27 18:35:00 +0000
committerNick Lewycky <nicholas@mxc.ca>2008-01-27 18:35:00 +0000
commitc837abee2fa6cdf75dcfbaf27d7c53613ec7ff7a (patch)
treecd02425f94b429186dcc75f361f4e60eeb963d90 /lib/Transforms/Scalar/LoopUnroll.cpp
parentd82375c1c43db7f823dd4660d3495e76566699e3 (diff)
downloadexternal_llvm-c837abee2fa6cdf75dcfbaf27d7c53613ec7ff7a.zip
external_llvm-c837abee2fa6cdf75dcfbaf27d7c53613ec7ff7a.tar.gz
external_llvm-c837abee2fa6cdf75dcfbaf27d7c53613ec7ff7a.tar.bz2
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
Diffstat (limited to 'lib/Transforms/Scalar/LoopUnroll.cpp')
-rw-r--r--lib/Transforms/Scalar/LoopUnroll.cpp3
1 files changed, 2 insertions, 1 deletions
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<Instruction>(*UI);
+ ++UI;
if (isa<PHINode>(UseInst) && !L->contains(UseInst->getParent())) {
PHINode *phi = cast<PHINode>(UseInst);
Value *Incoming = phi->getIncomingValueForBlock(*BB);