[llvm] r340210 - [LegacyPassManager] Remove analysis P from AnUsageMap before deleting it in schedulePass.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 20 13:57:30 PDT 2018


Author: ctopper
Date: Mon Aug 20 13:57:30 2018
New Revision: 340210

URL: http://llvm.org/viewvc/llvm-project?rev=340210&view=rev
Log:
[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

Modified:
    llvm/trunk/lib/IR/LegacyPassManager.cpp

Modified: llvm/trunk/lib/IR/LegacyPassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LegacyPassManager.cpp?rev=340210&r1=340209&r2=340210&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LegacyPassManager.cpp (original)
+++ llvm/trunk/lib/IR/LegacyPassManager.cpp Mon Aug 20 13:57:30 2018
@@ -677,6 +677,8 @@ void PMTopLevelManager::schedulePass(Pas
   // 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;
   }




More information about the llvm-commits mailing list