summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/LazyValueInfo.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2010-08-11 22:36:04 +0000
committerOwen Anderson <resistor@mac.com>2010-08-11 22:36:04 +0000
commit7b974a45db5f986edaad15be952af14aad492798 (patch)
treefb1671a91f46884cac98617802a87f527073f186 /llvm/lib/Analysis/LazyValueInfo.cpp
parentd385c22cf3a953c2b562ae3b282744f3a9c4acd3 (diff)
downloadbcm5719-llvm-7b974a45db5f986edaad15be952af14aad492798.tar.gz
bcm5719-llvm-7b974a45db5f986edaad15be952af14aad492798.zip
Fix a subtle use-after-free issue.
llvm-svn: 110863
Diffstat (limited to 'llvm/lib/Analysis/LazyValueInfo.cpp')
-rw-r--r--llvm/lib/Analysis/LazyValueInfo.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp
index c932e81e245..d3a437f9405 100644
--- a/llvm/lib/Analysis/LazyValueInfo.cpp
+++ b/llvm/lib/Analysis/LazyValueInfo.cpp
@@ -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);
}
OpenPOWER on IntegriCloud