[SCCP] Fix mem-sanitizer failure introduced by r315288.

llvm-svn: 315294
This commit is contained in:
Florian Hahn 2017-10-10 10:33:45 +00:00
parent b5ca92ef73
commit 7d2375df30
1 changed files with 4 additions and 2 deletions

View File

@ -1600,8 +1600,10 @@ static bool tryToReplaceWithConstantRange(SCCPSolver &Solver, Value *V) {
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;