summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/SCCP.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <florian.hahn@arm.com>2017-10-10 10:33:45 +0000
committerFlorian Hahn <florian.hahn@arm.com>2017-10-10 10:33:45 +0000
commit7d2375df305b2a7a2e96daa24e3ee63e772edec0 (patch)
treeeae4bf703d26dd7d178850b40c191a0cedd01707 /llvm/lib/Transforms/Scalar/SCCP.cpp
parentb5ca92ef7385e39c9bf3b5eaf8c76343397b54e4 (diff)
downloadbcm5719-llvm-7d2375df305b2a7a2e96daa24e3ee63e772edec0.tar.gz
bcm5719-llvm-7d2375df305b2a7a2e96daa24e3ee63e772edec0.zip
[SCCP] Fix mem-sanitizer failure introduced by r315288.
llvm-svn: 315294
Diffstat (limited to 'llvm/lib/Transforms/Scalar/SCCP.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/SCCP.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp
index b0f58367c94..ca46b9016df 100644
--- a/llvm/lib/Transforms/Scalar/SCCP.cpp
+++ b/llvm/lib/Transforms/Scalar/SCCP.cpp
@@ -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;
OpenPOWER on IntegriCloud