diff options
author | Tim Northover <tnorthover@apple.com> | 2019-08-16 09:34:27 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2019-08-16 09:34:27 +0000 |
commit | 22970d66be7856693ea56e7395909351d0885e57 (patch) | |
tree | 402d98d2567a993417f1c1a3aaa917fbe95dc3e3 /llvm/lib | |
parent | 71ae2bf302cce5e50cb495689f295ae29241c82c (diff) | |
download | bcm5719-llvm-22970d66be7856693ea56e7395909351d0885e57.tar.gz bcm5719-llvm-22970d66be7856693ea56e7395909351d0885e57.zip |
AssumptionCache: remove old affected values after RAUW.
If they're left in the cache then they can't be removed efficiently when the
cache is notified to unlink a @llvm.assume call, and that can lead to values
from different functions entirely remaining there.
llvm-svn: 369091
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Analysis/AssumptionCache.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/AssumptionCache.cpp b/llvm/lib/Analysis/AssumptionCache.cpp index 501191102b3..7d6429a0fec 100644 --- a/llvm/lib/Analysis/AssumptionCache.cpp +++ b/llvm/lib/Analysis/AssumptionCache.cpp @@ -140,7 +140,7 @@ void AssumptionCache::AffectedValueCallbackVH::deleted() { // 'this' now dangles! } -void AssumptionCache::copyAffectedValuesInCache(Value *OV, Value *NV) { +void AssumptionCache::transferAffectedValuesInCache(Value *OV, Value *NV) { auto &NAVV = getOrInsertAffectedValues(NV); auto AVI = AffectedValues.find(OV); if (AVI == AffectedValues.end()) @@ -149,6 +149,7 @@ void AssumptionCache::copyAffectedValuesInCache(Value *OV, Value *NV) { for (auto &A : AVI->second) if (std::find(NAVV.begin(), NAVV.end(), A) == NAVV.end()) NAVV.push_back(A); + AffectedValues.erase(OV); } void AssumptionCache::AffectedValueCallbackVH::allUsesReplacedWith(Value *NV) { @@ -157,7 +158,7 @@ void AssumptionCache::AffectedValueCallbackVH::allUsesReplacedWith(Value *NV) { // Any assumptions that affected this value now affect the new value. - AC->copyAffectedValuesInCache(getValPtr(), NV); + AC->transferAffectedValuesInCache(getValPtr(), NV); // 'this' now might dangle! If the AffectedValues map was resized to add an // entry for NV then this object might have been destroyed in favor of some // copy in the grown map. |