[llvm] d8a2ea9 - [LoopExtractor] Fix legacy pass dependencies

Ehud Katz via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 12 12:42:13 PST 2020


Author: Ehud Katz
Date: 2020-02-12T22:39:21+02:00
New Revision: d8a2ea9fd5c7c20c83e3301581fad692cfab15d0

URL: https://github.com/llvm/llvm-project/commit/d8a2ea9fd5c7c20c83e3301581fad692cfab15d0
DIFF: https://github.com/llvm/llvm-project/commit/d8a2ea9fd5c7c20c83e3301581fad692cfab15d0.diff

LOG: [LoopExtractor] Fix legacy pass dependencies

Fixes a memory leak of allocating `LoopInfoWrapperPass` and `DominatorTreeWrapperPass`.

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/LoopExtractor.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/LoopExtractor.cpp b/llvm/lib/Transforms/IPO/LoopExtractor.cpp
index 53dbee251aa5..14c39503e385 100644
--- a/llvm/lib/Transforms/IPO/LoopExtractor.cpp
+++ b/llvm/lib/Transforms/IPO/LoopExtractor.cpp
@@ -56,10 +56,10 @@ namespace {
 
     void getAnalysisUsage(AnalysisUsage &AU) const override {
       AU.addRequiredID(BreakCriticalEdgesID);
-      AU.addRequiredID(LoopSimplifyID);
       AU.addRequired<DominatorTreeWrapperPass>();
       AU.addRequired<LoopInfoWrapperPass>();
       AU.addPreserved<LoopInfoWrapperPass>();
+      AU.addRequiredID(LoopSimplifyID);
       AU.addUsedIfAvailable<AssumptionCacheTracker>();
     }
   };
@@ -69,9 +69,9 @@ char LoopExtractor::ID = 0;
 INITIALIZE_PASS_BEGIN(LoopExtractor, "loop-extract",
                       "Extract loops into new functions", false, false)
 INITIALIZE_PASS_DEPENDENCY(BreakCriticalEdges)
-INITIALIZE_PASS_DEPENDENCY(LoopSimplify)
 INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
 INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass)
+INITIALIZE_PASS_DEPENDENCY(LoopSimplify)
 INITIALIZE_PASS_END(LoopExtractor, "loop-extract",
                     "Extract loops into new functions", false, false)
 


        


More information about the llvm-commits mailing list