diff options
author | Dan Gohman <gohman@apple.com> | 2010-10-29 20:16:10 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-10-29 20:16:10 +0000 |
commit | dcb354b2342371fcbe9d179bdf67197a7aa4281f (patch) | |
tree | 863aba4441192af90ded34a6d343edc3162a6da7 /llvm/lib/Analysis/ScalarEvolution.cpp | |
parent | acc8709850bb9a043166392fcd4ab9bcbc85ae1c (diff) | |
download | bcm5719-llvm-dcb354b2342371fcbe9d179bdf67197a7aa4281f.tar.gz bcm5719-llvm-dcb354b2342371fcbe9d179bdf67197a7aa4281f.zip |
Make ScalarEvolution::forgetLoop forget all contained loops too, because
they may have ValuesAtScopes map entries referencing their outer loops.
This fixes a user-after-free reported in PR8471.
llvm-svn: 117698
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 5ae273e56d2..4d750b4464b 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -3781,6 +3781,11 @@ void ScalarEvolution::forgetLoop(const Loop *L) { PushDefUseChildren(I, Worklist); } + + // Forget all contained loops too, to avoid dangling entries in the + // ValuesAtScopes map. + for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I) + forgetLoop(*I); } /// forgetValue - This method should be called by the client when it has |