summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/LegacyPassManager.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2018-08-20 20:57:30 +0000
committerCraig Topper <craig.topper@intel.com>2018-08-20 20:57:30 +0000
commit4ee28412a56d1ab47e06743f6cc7492aba1e91ad (patch)
tree8df44a801138089dfcdc522c0fe28ff1edaa60e5 /llvm/lib/IR/LegacyPassManager.cpp
parentcc3f630252c7290e6b093dae7a52c7ec14dee0e5 (diff)
downloadbcm5719-llvm-4ee28412a56d1ab47e06743f6cc7492aba1e91ad.tar.gz
bcm5719-llvm-4ee28412a56d1ab47e06743f6cc7492aba1e91ad.zip
[LegacyPassManager] Remove analysis P from AnUsageMap before deleting it in schedulePass.
If we deem the analysis pass useless and delete it, we need to make sure we remove it from AnUsageMap. Otherwise we might allocate another pass in the freed memory. This will cause us to reuse the AnalysisUsage from the original pass instead of the new one. Fixes PR38511 Differential Revision: https://reviews.llvm.org/D50573 llvm-svn: 340210
Diffstat (limited to 'llvm/lib/IR/LegacyPassManager.cpp')
-rw-r--r--llvm/lib/IR/LegacyPassManager.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp
index 54d602d926e..d11a2b3c01a 100644
--- a/llvm/lib/IR/LegacyPassManager.cpp
+++ b/llvm/lib/IR/LegacyPassManager.cpp
@@ -677,6 +677,8 @@ void PMTopLevelManager::schedulePass(Pass *P) {
// available at this point.
const PassInfo *PI = findAnalysisPassInfo(P->getPassID());
if (PI && PI->isAnalysis() && findAnalysisPass(P->getPassID())) {
+ // Remove any cached AnalysisUsage information.
+ AnUsageMap.erase(P);
delete P;
return;
}
OpenPOWER on IntegriCloud