Fix a subtle use-after-free issue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110863 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2010-08-11 22:36:04 +00:00
parent 7f9ef4bb51
commit cf6abd2486

View File

@ -384,7 +384,6 @@ namespace {
} // end anonymous namespace
void LazyValueInfoCache::LVIValueHandle::deleted() {
Parent->ValueCache.erase(*this);
for (std::set<std::pair<BasicBlock*, Value*> >::iterator
I = Parent->OverDefinedCache.begin(),
E = Parent->OverDefinedCache.end();
@ -394,6 +393,10 @@ void LazyValueInfoCache::LVIValueHandle::deleted() {
if (tmp->second == getValPtr())
Parent->OverDefinedCache.erase(tmp);
}
// This erasure deallocates *this, so it MUST happen after we're done
// using any and all members of *this.
Parent->ValueCache.erase(*this);
}