diff options
-rw-r--r-- | llvm/lib/Transforms/Scalar/SCCP.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp index ca46b9016df..b0f58367c94 100644 --- a/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/llvm/lib/Transforms/Scalar/SCCP.cpp @@ -1600,10 +1600,8 @@ static bool tryToReplaceWithConstantRange(SCCPSolver &Solver, Value *V) { if (!(V->getType()->isIntegerTy() && IV.isConstantRange())) return false; - 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()); + for (auto &Use : V->uses()) { + auto *Icmp = dyn_cast<ICmpInst>(Use.getUser()); if (!Icmp) continue; |