From: Krzysztof Parzyszek Date: Wed, 25 Jan 2017 16:12:25 +0000 (+0000) Subject: Add loop pass insertion point EP_LateLoopOptimizations X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=396de7fcfb6fd3bd539cd1dade0d4ee4a983b2fd;p=llvm Add loop pass insertion point EP_LateLoopOptimizations Differential Revision: https://reviews.llvm.org/D28694 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293067 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Transforms/IPO/PassManagerBuilder.h b/include/llvm/Transforms/IPO/PassManagerBuilder.h index 83af3ac231b..1782e7e37b4 100644 --- a/include/llvm/Transforms/IPO/PassManagerBuilder.h +++ b/include/llvm/Transforms/IPO/PassManagerBuilder.h @@ -101,6 +101,14 @@ public: /// will be inserted after each instance of the instruction combiner pass. EP_Peephole, + /// EP_LateLoopOptimizations - This extension point allows adding late loop + /// canonicalization and simplification passes. This is the last point in + /// the loop optimization pipeline before loop deletion. Each pass added + /// here must be an instance of LoopPass. + /// This is the place to add passes that can remove loops, such as target- + /// specific loop idiom recognition. + EP_LateLoopOptimizations, + /// EP_CGSCCOptimizerLate - This extension point allows adding CallGraphSCC /// passes at the end of the main CallGraphSCC passes and before any /// function simplification passes run by CGPassManager. diff --git a/lib/Transforms/IPO/PassManagerBuilder.cpp b/lib/Transforms/IPO/PassManagerBuilder.cpp index 8d0963f2060..88de06c4d2a 100644 --- a/lib/Transforms/IPO/PassManagerBuilder.cpp +++ b/lib/Transforms/IPO/PassManagerBuilder.cpp @@ -316,7 +316,9 @@ void PassManagerBuilder::addFunctionSimplificationPasses( addInstructionCombiningPass(MPM); MPM.add(createIndVarSimplifyPass()); // Canonicalize indvars MPM.add(createLoopIdiomPass()); // Recognize idioms like memset. + addExtensionsToPM(EP_LateLoopOptimizations, MPM); MPM.add(createLoopDeletionPass()); // Delete dead loops + if (EnableLoopInterchange) { MPM.add(createLoopInterchangePass()); // Interchange loops MPM.add(createCFGSimplificationPass());