Revert "[SCCP] Fix mem-sanitizer failure introduced by r315288."
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Tue, 10 Oct 2017 16:37:51 +0000 (16:37 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Tue, 10 Oct 2017 16:37:51 +0000 (16:37 +0000)
This reverts commit r315294. Part of fixing seg fault introduced in:
http://green.lab.llvm.org/green/job/clang-stage2-configure-Rlto/21675/

llvm-svn: 315328

llvm/lib/Transforms/Scalar/SCCP.cpp

index ca46b9016df63209da0299085a21cdb696bb05d1..b0f58367c94c907ad4a0ce7629741b718c5f782f 100644 (file)
@@ -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;