git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315294
91177308-0d34-0410-b5e6-
96231b3b80d8
if (!(V->getType()->isIntegerTy() && IV.isConstantRange()))
return false;
- for (auto &Use : V->uses()) {
- auto *Icmp = dyn_cast<ICmpInst>(Use.getUser());
+ for (auto UI = V->uses().begin(), E = V->uses().end(); UI != E;) {
+ // Advance the iterator here, as we might remove the current use.
+ const Use &U = *UI++;
+ auto *Icmp = dyn_cast<ICmpInst>(U.getUser());
if (!Icmp)
continue;