Index: include/llvm/Analysis/IVUsers.h =================================================================== --- include/llvm/Analysis/IVUsers.h +++ include/llvm/Analysis/IVUsers.h @@ -16,7 +16,7 @@ #define LLVM_ANALYSIS_IVUSERS_H #include "llvm/Analysis/LoopPass.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Analysis/ScalarEvolutionNormalization.h" #include "llvm/IR/ValueHandle.h" Index: include/llvm/Analysis/LoopAccessAnalysis.h =================================================================== --- include/llvm/Analysis/LoopAccessAnalysis.h +++ include/llvm/Analysis/LoopAccessAnalysis.h @@ -20,7 +20,7 @@ #include "llvm/ADT/SetVector.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/AliasSetTracker.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Analysis/ScalarEvolutionExpressions.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/ValueHandle.h" Index: include/llvm/Analysis/LoopPassManager.h =================================================================== --- /dev/null +++ include/llvm/Analysis/LoopPassManager.h @@ -1,472 +0,0 @@ -//===- LoopPassManager.h - Loop pass management -----------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -/// \file -/// -/// This header provides classes for managing a pipeline of passes over loops -/// in LLVM IR. -/// -/// The primary loop pass pipeline is managed in a very particular way to -/// provide a set of core guarantees: -/// 1) Loops are, where possible, in simplified form. -/// 2) Loops are *always* in LCSSA form. -/// 3) A collection of Loop-specific analysis results are available: -/// - LoopInfo -/// - DominatorTree -/// - ScalarEvolution -/// - AAManager -/// 4) All loop passes preserve #1 (where possible), #2, and #3. -/// 5) Loop passes run over each loop in the loop nest from the innermost to -/// the outermost. Specifically, all inner loops are processed before -/// passes run over outer loops. When running the pipeline across an inner -/// loop creates new inner loops, those are added and processed in this -/// order as well. -/// -/// This process is designed to facilitate transformations which simplify, -/// reduce, and remove loops. For passes which are more oriented towards -/// optimizing loops, especially optimizing loop *nests* instead of single -/// loops in isolation, this framework is less interesting. -/// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ANALYSIS_LOOPPASSMANAGER_H -#define LLVM_ANALYSIS_LOOPPASSMANAGER_H - -#include "llvm/ADT/PostOrderIterator.h" -#include "llvm/ADT/PriorityWorklist.h" -#include "llvm/ADT/STLExtras.h" -#include "llvm/Analysis/AliasAnalysis.h" -#include "llvm/Analysis/BasicAliasAnalysis.h" -#include "llvm/Analysis/GlobalsModRef.h" -#include "llvm/Analysis/LoopInfo.h" -#include "llvm/Analysis/ScalarEvolution.h" -#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h" -#include "llvm/Analysis/TargetLibraryInfo.h" -#include "llvm/Analysis/TargetTransformInfo.h" -#include "llvm/IR/Dominators.h" -#include "llvm/IR/PassManager.h" - -namespace llvm { - -// Forward declarations of a update tracking and analysis result tracking -// structures used in the API of loop passes that work within this -// infrastructure. -class LPMUpdateResult; -struct LPMAnalysisResults; - -/// Extern template declaration for the analysis set for this IR unit. -extern template class AllAnalysesOn; - -extern template class AnalysisManager; -/// \brief The loop analysis manager. -/// -/// See the documentation for the AnalysisManager template for detail -/// documentation. This typedef serves as a convenient way to refer to this -/// construct in the adaptors and proxies used to integrate this into the larger -/// pass manager infrastructure. -typedef AnalysisManager LoopAnalysisManager; - -// Explicit specialization and instantiation declarations for the pass manager. -// See the comments on the definition of the specialization for details on how -// it differs from the primary template. -template <> -PreservedAnalyses -PassManager::run(Loop &InitialL, LoopAnalysisManager &AM, - LPMAnalysisResults &AnalysisResults, - LPMUpdateResult &UR); -extern template class PassManager; - -/// \brief The Loop pass manager. -/// -/// See the documentation for the PassManager template for details. It runs -/// a sequence of Loop passes over each Loop that the manager is run over. This -/// typedef serves as a convenient way to refer to this construct. -typedef PassManager - LoopPassManager; - -/// A partial specialization of the require analysis template pass to correctly -/// forward the necessary extra parameters from a transformation's run method -/// to the AnalysisManager's getResult. -template -struct RequireAnalysisPass - : PassInfoMixin< - RequireAnalysisPass> { - PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM, - LPMAnalysisResults &AR, LPMUpdateResult &) { - (void)AM.template getResult(L, AR); - return PreservedAnalyses::all(); - } -}; - -/// An alias template to easily name a require analysis loop pass. -template -using RequireAnalysisLoopPass = - RequireAnalysisPass; - -/// A proxy from a \c LoopAnalysisManager to a \c Function. -typedef InnerAnalysisManagerProxy - LoopAnalysisManagerFunctionProxy; - -/// A specialized result for the \c LoopAnalysisManagerFunctionProxy which -/// retains a \c LoopInfo reference. -/// -/// This allows it to collect loop objects for which analysis results may be -/// cached in the \c LoopAnalysisManager. -template <> class LoopAnalysisManagerFunctionProxy::Result { -public: - explicit Result(LoopAnalysisManager &InnerAM, LoopInfo &LI) - : InnerAM(&InnerAM), LI(&LI) {} - Result(Result &&Arg) : InnerAM(std::move(Arg.InnerAM)), LI(Arg.LI) { - // We have to null out the analysis manager in the moved-from state - // because we are taking ownership of the responsibilty to clear the - // analysis state. - Arg.InnerAM = nullptr; - } - Result &operator=(Result &&RHS) { - InnerAM = RHS.InnerAM; - LI = RHS.LI; - // We have to null out the analysis manager in the moved-from state - // because we are taking ownership of the responsibilty to clear the - // analysis state. - RHS.InnerAM = nullptr; - return *this; - } - ~Result() { - // InnerAM is cleared in a moved from state where there is nothing to do. - if (!InnerAM) - return; - - // Clear out the analysis manager if we're being destroyed -- it means we - // didn't even see an invalidate call when we got invalidated. - InnerAM->clear(); - } - - /// Accessor for the analysis manager. - LoopAnalysisManager &getManager() { return *InnerAM; } - - /// Handler for invalidation of the proxy for a particular function. - /// - /// If the proxy, \c LoopInfo, and associated analyses are preserved, this - /// will merely forward the invalidation event to any cached loop analysis - /// results for loops within this function. - /// - /// If the necessary loop infrastructure is not preserved, this will forcibly - /// clear all of the cached analysis results that are keyed on the \c - /// LoopInfo for this function. - bool invalidate(Function &F, const PreservedAnalyses &PA, - FunctionAnalysisManager::Invalidator &Inv); - -private: - LoopAnalysisManager *InnerAM; - LoopInfo *LI; -}; - -/// Provide a specialized run method for the \c LoopAnalysisManagerFunctionProxy -/// so it can pass the \c LoopInfo to the result. -template <> -LoopAnalysisManagerFunctionProxy::Result -LoopAnalysisManagerFunctionProxy::run(Function &F, FunctionAnalysisManager &AM); - -// Ensure the \c LoopAnalysisManagerFunctionProxy is provided as an extern -// template. -extern template class InnerAnalysisManagerProxy; - -extern template class OuterAnalysisManagerProxy; -/// A proxy from a \c FunctionAnalysisManager to a \c Loop. -typedef OuterAnalysisManagerProxy - FunctionAnalysisManagerLoopProxy; - -/// Returns the minimum set of Analyses that all loop passes must preserve. -PreservedAnalyses getLoopPassPreservedAnalyses(); - -namespace internal { -/// Helper to implement appending of loops onto a worklist. -/// -/// We want to process loops in postorder, but the worklist is a LIFO data -/// structure, so we append to it in *reverse* postorder. -/// -/// For trees, a preorder traversal is a viable reverse postorder, so we -/// actually append using a preorder walk algorithm. -template -inline void appendLoopsToWorklist(RangeT &&Loops, - SmallPriorityWorklist &Worklist) { - // We use an internal worklist to build up the preorder traversal without - // recursion. - SmallVector PreOrderLoops, PreOrderWorklist; - - // We walk the initial sequence of loops in reverse because we generally want - // to visit defs before uses and the worklist is LIFO. - for (Loop *RootL : reverse(Loops)) { - assert(PreOrderLoops.empty() && "Must start with an empty preorder walk."); - assert(PreOrderWorklist.empty() && - "Must start with an empty preorder walk worklist."); - PreOrderWorklist.push_back(RootL); - do { - Loop *L = PreOrderWorklist.pop_back_val(); - PreOrderWorklist.append(L->begin(), L->end()); - PreOrderLoops.push_back(L); - } while (!PreOrderWorklist.empty()); - - Worklist.insert(std::move(PreOrderLoops)); - PreOrderLoops.clear(); - } -} -} - -/// The adaptor from a function pass to a loop pass directly computes a set of -/// analyses that are especially useful to loop passes and makes them available -/// in the API. Loop passes are also expected to update all of these so that -/// they remain correct across the entire loop pipeline. -struct LPMAnalysisResults { - AAResults &AA; - AssumptionCache &AC; - DominatorTree &DT; - LoopInfo &LI; - ScalarEvolution &SE; - TargetLibraryInfo &TLI; - TargetTransformInfo &TTI; -}; - -template class FunctionToLoopPassAdaptor; - -/// This class provides an interface for updating the loop pass manager based -/// on mutations to the loop nest. -/// -/// A reference to an instance of this class is passed as an argument to each -/// Loop pass, and Loop passes should use it to update LPM infrastructure if -/// they modify the loop nest structure. -class LPMUpdateResult { -public: - /// This can be queried by loop passes which run other loop passes (like pass - /// managers) to know whether the loop needs to be skipped due to updates to - /// the loop nest. - /// - /// If this returns true, the loop object may have been deleted, so passes - /// should take care not to touch the object. - bool skipCurrentLoop() const { return SkipCurrentLoop; } - - /// Loop passes should use this method to indicate they have deleted a loop - /// from the nest. - /// - /// Note that this loop must either be the current loop or a subloop of the - /// current loop. This routine must be called prior to removing the loop from - /// the loop nest. - /// - /// If this is called for the current loop, in addition to clearing any - /// state, this routine will mark that the current loop should be skipped by - /// the rest of the pass management infrastructure. - void markLoopAsDeleted(Loop &L) { - LAM.clear(L); - assert(CurrentL->contains(&L) && "Cannot delete a loop outside of the " - "subloop tree currently being processed."); - if (&L == CurrentL) - SkipCurrentLoop = true; - } - - /// Loop passes should use this method to indicate they have added new child - /// loops of the current loop. - /// - /// \p NewChildLoops must contain only the immediate children. Any nested - /// loops within them will be visited in postorder as usual for the loop pass - /// manager. - void addChildLoops(ArrayRef NewChildLoops) { - // Insert ourselves back into the worklist first, as this loop should be - // revisited after all the children have been processed. - Worklist.insert(CurrentL); - -#ifndef NDEBUG - for (Loop *NewL : NewChildLoops) - assert(NewL->getParentLoop() == CurrentL && "All of the new loops must " - "be immediate children of " - "the current loop!"); -#endif - - internal::appendLoopsToWorklist(NewChildLoops, Worklist); - - // Also skip further processing of the current loop--it will be revisited - // after all of its newly added children are accounted for. - SkipCurrentLoop = true; - } - - /// Loop passes should use this method to indicate they have added new - /// sibling loops to the current loop. - /// - /// \p NewSibLoops must only contain the immediate sibling loops. Any nested - /// loops within them will be visited in postorder as usual for the loop pass - /// manager. - void addSiblingLoops(ArrayRef NewSibLoops) { -#ifndef NDEBUG - for (Loop *NewL : NewSibLoops) - assert(NewL->getParentLoop() == ParentL && - "All of the new loops must be siblings of the current loop!"); -#endif - - internal::appendLoopsToWorklist(NewSibLoops, Worklist); - - // No need to skip the current loop or revisit it, as sibling loops - // shouldn't impact anything. - } - -private: - template friend class llvm::FunctionToLoopPassAdaptor; - - /// The \c FunctionToLoopPassAdaptor's worklist of loops to process. - SmallPriorityWorklist &Worklist; - - /// The analysis manager for use in the current loop nest. - LoopAnalysisManager &LAM; - - Loop *CurrentL; - bool SkipCurrentLoop; - -#ifndef NDEBUG - // In debug builds we also track the parent loop to implement asserts even in - // the face of loop deletion. - Loop *ParentL; -#endif - - LPMUpdateResult(SmallPriorityWorklist &Worklist, - LoopAnalysisManager &LAM) - : Worklist(Worklist), LAM(LAM) {} -}; - -/// \brief Adaptor that maps from a function to its loops. -/// -/// Designed to allow composition of a LoopPass(Manager) and a -/// FunctionPassManager. Note that if this pass is constructed with a \c -/// FunctionAnalysisManager it will run the \c LoopAnalysisManagerFunctionProxy -/// analysis prior to running the loop passes over the function to enable a \c -/// LoopAnalysisManager to be used within this run safely. -template -class FunctionToLoopPassAdaptor - : public PassInfoMixin> { -public: - explicit FunctionToLoopPassAdaptor(LoopPassT Pass) - : Pass(std::move(Pass)) {} - - /// \brief Runs the loop passes across every loop in the function. - PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM) { - // Setup the loop analysis manager from its proxy. - LoopAnalysisManager &LAM = - AM.getResult(F).getManager(); - // Get the loop structure for this function - LoopInfo &LI = AM.getResult(F); - - // If there are no loops, there is nothing to do here. - if (LI.empty()) - return PreservedAnalyses::all(); - - // Get the analysis results needed by loop passes. - LPMAnalysisResults LAR = {AM.getResult(F), - AM.getResult(F), - AM.getResult(F), - AM.getResult(F), - AM.getResult(F), - AM.getResult(F), - AM.getResult(F)}; - - PreservedAnalyses PA = PreservedAnalyses::all(); - - // A postorder worklist of loops to process. - SmallPriorityWorklist Worklist; - - // Register the worklist and loop analysis manager so that loop passes can - // update them when they mutate the loop nest structure. - LPMUpdateResult UR(Worklist, LAM); - - // Add the loop nests in the reverse order of LoopInfo. For some reason, - // they are stored in RPO w.r.t. the control flow graph in LoopInfo. For - // the purpose of unrolling, loop deletion, and LICM, we largely want to - // work forward across the CFG so that we visit defs before uses and can - // propagate simplifications from one loop nest into the next. - // FIXME: Consider changing the order in LoopInfo. - internal::appendLoopsToWorklist(reverse(LI), Worklist); - - do { - Loop *L = Worklist.pop_back_val(); - - // Reset the update structure for this loop. - UR.CurrentL = L; - UR.SkipCurrentLoop = false; -#ifndef NDEBUG - UR.ParentL = L->getParentLoop(); -#endif - - PreservedAnalyses PassPA = Pass.run(*L, LAM, LAR, UR); - // FIXME: We should verify the set of analyses relevant to Loop passes - // are preserved. - - // If the loop hasn't been deleted, we need to handle invalidation here. - if (!UR.skipCurrentLoop()) - // We know that the loop pass couldn't have invalidated any other - // loop's analyses (that's the contract of a loop pass), so directly - // handle the loop analysis manager's invalidation here. - LAM.invalidate(*L, PassPA); - - // Then intersect the preserved set so that invalidation of module - // analyses will eventually occur when the module pass completes. - PA.intersect(std::move(PassPA)); - } while (!Worklist.empty()); - - // By definition we preserve the proxy. We also preserve all analyses on - // Loops. This precludes *any* invalidation of loop analyses by the proxy, - // but that's OK because we've taken care to invalidate analyses in the - // loop analysis manager incrementally above. - PA.preserveSet>(); - PA.preserve(); - // We also preserve the set of analyses queried up-front and preserved - // throughout the run. This avoids each individual loop pass having to mark - // this. - PA.preserve(); - PA.preserve(); - PA.preserve(); - PA.preserve(); - // FIXME: What we really want to do here is preserve an AA category, but - // that concept doesn't exist yet. - PA.preserve(); - PA.preserve(); - PA.preserve(); - PA.preserve(); - return PA; - } - -private: - LoopPassT Pass; -}; - -/// \brief A function to deduce a loop pass type and wrap it in the templated -/// adaptor. -template -FunctionToLoopPassAdaptor -createFunctionToLoopPassAdaptor(LoopPassT Pass) { - return FunctionToLoopPassAdaptor(std::move(Pass)); -} - -/// \brief Pass for printing a loop's contents as textual IR. -class PrintLoopPass : public PassInfoMixin { - raw_ostream &OS; - std::string Banner; - -public: - PrintLoopPass(); - PrintLoopPass(raw_ostream &OS, const std::string &Banner = ""); - - PreservedAnalyses run(Loop &L, LoopAnalysisManager &, LPMAnalysisResults &, - LPMUpdateResult &); -}; -} - -#endif // LLVM_ANALYSIS_LOOPPASSMANAGER_H Index: include/llvm/Passes/PassBuilder.h =================================================================== --- include/llvm/Passes/PassBuilder.h +++ include/llvm/Passes/PassBuilder.h @@ -18,7 +18,7 @@ #include "llvm/ADT/Optional.h" #include "llvm/Analysis/CGSCCPassManager.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/IR/PassManager.h" #include Index: include/llvm/Transforms/Scalar/IndVarSimplify.h =================================================================== --- include/llvm/Transforms/Scalar/IndVarSimplify.h +++ include/llvm/Transforms/Scalar/IndVarSimplify.h @@ -16,7 +16,7 @@ #define LLVM_TRANSFORMS_SCALAR_INDVARSIMPLIFY_H #include "llvm/Analysis/LoopInfo.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/IR/PassManager.h" namespace llvm { Index: include/llvm/Transforms/Scalar/LICM.h =================================================================== --- include/llvm/Transforms/Scalar/LICM.h +++ include/llvm/Transforms/Scalar/LICM.h @@ -34,7 +34,7 @@ #define LLVM_TRANSFORMS_SCALAR_LICM_H #include "llvm/Analysis/LoopInfo.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/IR/PassManager.h" namespace llvm { Index: include/llvm/Transforms/Scalar/LoopDeletion.h =================================================================== --- include/llvm/Transforms/Scalar/LoopDeletion.h +++ include/llvm/Transforms/Scalar/LoopDeletion.h @@ -15,7 +15,7 @@ #define LLVM_TRANSFORMS_SCALAR_LOOPDELETION_H #include "llvm/Analysis/LoopInfo.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/IR/PassManager.h" Index: include/llvm/Transforms/Scalar/LoopIdiomRecognize.h =================================================================== --- include/llvm/Transforms/Scalar/LoopIdiomRecognize.h +++ include/llvm/Transforms/Scalar/LoopIdiomRecognize.h @@ -17,7 +17,7 @@ #define LLVM_TRANSFORMS_SCALAR_LOOPIDIOMRECOGNIZE_H #include "llvm/Analysis/LoopInfo.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/IR/PassManager.h" namespace llvm { Index: include/llvm/Transforms/Scalar/LoopInstSimplify.h =================================================================== --- include/llvm/Transforms/Scalar/LoopInstSimplify.h +++ include/llvm/Transforms/Scalar/LoopInstSimplify.h @@ -15,7 +15,7 @@ #define LLVM_TRANSFORMS_SCALAR_LOOPINSTSIMPLIFY_H #include "llvm/Analysis/LoopInfo.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/IR/PassManager.h" namespace llvm { Index: include/llvm/Transforms/Scalar/LoopRotation.h =================================================================== --- include/llvm/Transforms/Scalar/LoopRotation.h +++ include/llvm/Transforms/Scalar/LoopRotation.h @@ -15,7 +15,7 @@ #define LLVM_TRANSFORMS_SCALAR_LOOPROTATION_H #include "llvm/Analysis/LoopInfo.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/IR/PassManager.h" namespace llvm { Index: include/llvm/Transforms/Scalar/LoopSimplifyCFG.h =================================================================== --- include/llvm/Transforms/Scalar/LoopSimplifyCFG.h +++ include/llvm/Transforms/Scalar/LoopSimplifyCFG.h @@ -18,7 +18,7 @@ #define LLVM_TRANSFORMS_SCALAR_LOOPSIMPLIFYCFG_H #include "llvm/Analysis/LoopInfo.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/IR/PassManager.h" namespace llvm { Index: include/llvm/Transforms/Scalar/LoopStrengthReduce.h =================================================================== --- include/llvm/Transforms/Scalar/LoopStrengthReduce.h +++ include/llvm/Transforms/Scalar/LoopStrengthReduce.h @@ -23,7 +23,7 @@ #define LLVM_TRANSFORMS_SCALAR_LOOPSTRENGTHREDUCE_H #include "llvm/Analysis/LoopInfo.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/IR/PassManager.h" namespace llvm { Index: include/llvm/Transforms/Scalar/LoopUnrollPass.h =================================================================== --- include/llvm/Transforms/Scalar/LoopUnrollPass.h +++ include/llvm/Transforms/Scalar/LoopUnrollPass.h @@ -11,7 +11,7 @@ #define LLVM_TRANSFORMS_SCALAR_LOOPUNROLLPASS_H #include "llvm/Analysis/LoopInfo.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/IR/PassManager.h" namespace llvm { Index: include/llvm/Transforms/Vectorize/LoopVectorize.h =================================================================== --- include/llvm/Transforms/Vectorize/LoopVectorize.h +++ include/llvm/Transforms/Vectorize/LoopVectorize.h @@ -57,7 +57,7 @@ #include "llvm/Analysis/DemandedBits.h" #include "llvm/Analysis/LoopAccessAnalysis.h" #include "llvm/Analysis/LoopInfo.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Analysis/OptimizationDiagnosticInfo.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Analysis/TargetTransformInfo.h" Index: lib/Analysis/CMakeLists.txt =================================================================== --- lib/Analysis/CMakeLists.txt +++ lib/Analysis/CMakeLists.txt @@ -47,7 +47,6 @@ LoopUnrollAnalyzer.cpp LoopInfo.cpp LoopPass.cpp - LoopPassManager.cpp MemDepPrinter.cpp MemDerefPrinter.cpp MemoryBuiltins.cpp Index: lib/Analysis/IVUsers.cpp =================================================================== --- lib/Analysis/IVUsers.cpp +++ lib/Analysis/IVUsers.cpp @@ -17,7 +17,7 @@ #include "llvm/Analysis/AssumptionCache.h" #include "llvm/Analysis/CodeMetrics.h" #include "llvm/Analysis/LoopPass.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Analysis/ScalarEvolutionExpressions.h" #include "llvm/Analysis/ValueTracking.h" #include "llvm/IR/Constants.h" Index: lib/Analysis/LoopAccessAnalysis.cpp =================================================================== --- lib/Analysis/LoopAccessAnalysis.cpp +++ lib/Analysis/LoopAccessAnalysis.cpp @@ -27,7 +27,7 @@ #include "llvm/Analysis/AliasSetTracker.h" #include "llvm/Analysis/LoopAccessAnalysis.h" #include "llvm/Analysis/LoopInfo.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Analysis/MemoryLocation.h" #include "llvm/Analysis/OptimizationDiagnosticInfo.h" #include "llvm/Analysis/ScalarEvolution.h" Index: lib/Analysis/LoopPass.cpp =================================================================== --- lib/Analysis/LoopPass.cpp +++ lib/Analysis/LoopPass.cpp @@ -14,7 +14,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Analysis/LoopPass.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/IRPrintingPasses.h" #include "llvm/IR/LLVMContext.h" Index: lib/LTO/LTOBackend.cpp =================================================================== --- lib/LTO/LTOBackend.cpp +++ lib/LTO/LTOBackend.cpp @@ -17,7 +17,7 @@ #include "llvm/LTO/LTOBackend.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/CGSCCPassManager.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/Bitcode/BitcodeReader.h" Index: lib/Passes/PassBuilder.cpp =================================================================== --- lib/Passes/PassBuilder.cpp +++ lib/Passes/PassBuilder.cpp @@ -38,7 +38,6 @@ #include "llvm/Analysis/LazyValueInfo.h" #include "llvm/Analysis/LoopAccessAnalysis.h" #include "llvm/Analysis/LoopInfo.h" -#include "llvm/Analysis/LoopPassManager.h" #include "llvm/Analysis/MemoryDependenceAnalysis.h" #include "llvm/Analysis/ModuleSummaryAnalysis.h" #include "llvm/Analysis/OptimizationDiagnosticInfo.h" @@ -103,6 +102,7 @@ #include "llvm/Transforms/Scalar/LoopDistribute.h" #include "llvm/Transforms/Scalar/LoopIdiomRecognize.h" #include "llvm/Transforms/Scalar/LoopInstSimplify.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Transforms/Scalar/LoopRotation.h" #include "llvm/Transforms/Scalar/LoopSimplifyCFG.h" #include "llvm/Transforms/Scalar/LoopStrengthReduce.h" Index: lib/Transforms/Scalar/CMakeLists.txt =================================================================== --- lib/Transforms/Scalar/CMakeLists.txt +++ lib/Transforms/Scalar/CMakeLists.txt @@ -26,6 +26,7 @@ LoopInstSimplify.cpp LoopInterchange.cpp LoopLoadElimination.cpp + LoopPassManager.cpp LoopRerollPass.cpp LoopRotation.cpp LoopSimplifyCFG.cpp Index: lib/Transforms/Scalar/IndVarSimplify.cpp =================================================================== --- lib/Transforms/Scalar/IndVarSimplify.cpp +++ lib/Transforms/Scalar/IndVarSimplify.cpp @@ -31,7 +31,7 @@ #include "llvm/Analysis/GlobalsModRef.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopPass.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Analysis/ScalarEvolutionExpander.h" #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h" #include "llvm/Analysis/TargetLibraryInfo.h" Index: lib/Transforms/Scalar/LICM.cpp =================================================================== --- lib/Transforms/Scalar/LICM.cpp +++ lib/Transforms/Scalar/LICM.cpp @@ -41,7 +41,7 @@ #include "llvm/Analysis/Loads.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopPass.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Analysis/MemoryBuiltins.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h" Index: lib/Transforms/Scalar/LoopDeletion.cpp =================================================================== --- lib/Transforms/Scalar/LoopDeletion.cpp +++ lib/Transforms/Scalar/LoopDeletion.cpp @@ -19,7 +19,7 @@ #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/GlobalsModRef.h" #include "llvm/Analysis/LoopPass.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/IR/Dominators.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/LoopUtils.h" Index: lib/Transforms/Scalar/LoopDistribute.cpp =================================================================== --- lib/Transforms/Scalar/LoopDistribute.cpp +++ lib/Transforms/Scalar/LoopDistribute.cpp @@ -31,7 +31,7 @@ #include "llvm/Analysis/GlobalsModRef.h" #include "llvm/Analysis/LoopAccessAnalysis.h" #include "llvm/Analysis/LoopInfo.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Analysis/OptimizationDiagnosticInfo.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/Dominators.h" Index: lib/Transforms/Scalar/LoopIdiomRecognize.cpp =================================================================== --- lib/Transforms/Scalar/LoopIdiomRecognize.cpp +++ lib/Transforms/Scalar/LoopIdiomRecognize.cpp @@ -46,7 +46,7 @@ #include "llvm/Analysis/GlobalsModRef.h" #include "llvm/Analysis/LoopAccessAnalysis.h" #include "llvm/Analysis/LoopPass.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h" #include "llvm/Analysis/ScalarEvolutionExpander.h" #include "llvm/Analysis/ScalarEvolutionExpressions.h" Index: lib/Transforms/Scalar/LoopInstSimplify.cpp =================================================================== --- lib/Transforms/Scalar/LoopInstSimplify.cpp +++ lib/Transforms/Scalar/LoopInstSimplify.cpp @@ -18,7 +18,7 @@ #include "llvm/Analysis/InstructionSimplify.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopPass.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/IR/DataLayout.h" Index: lib/Transforms/Scalar/LoopPassManager.cpp =================================================================== --- lib/Transforms/Scalar/LoopPassManager.cpp +++ lib/Transforms/Scalar/LoopPassManager.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Analysis/BasicAliasAnalysis.h" #include "llvm/Analysis/GlobalsModRef.h" #include "llvm/Analysis/LoopInfo.h" Index: lib/Transforms/Scalar/LoopRotation.cpp =================================================================== --- lib/Transforms/Scalar/LoopRotation.cpp +++ lib/Transforms/Scalar/LoopRotation.cpp @@ -20,7 +20,7 @@ #include "llvm/Analysis/InstructionSimplify.h" #include "llvm/Analysis/GlobalsModRef.h" #include "llvm/Analysis/LoopPass.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h" #include "llvm/Analysis/TargetTransformInfo.h" Index: lib/Transforms/Scalar/LoopSimplifyCFG.cpp =================================================================== --- lib/Transforms/Scalar/LoopSimplifyCFG.cpp +++ lib/Transforms/Scalar/LoopSimplifyCFG.cpp @@ -24,7 +24,7 @@ #include "llvm/Analysis/GlobalsModRef.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopPass.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h" #include "llvm/Analysis/TargetTransformInfo.h" Index: lib/Transforms/Scalar/LoopSink.cpp =================================================================== --- lib/Transforms/Scalar/LoopSink.cpp +++ lib/Transforms/Scalar/LoopSink.cpp @@ -38,7 +38,7 @@ #include "llvm/Analysis/Loads.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopPass.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h" #include "llvm/IR/Dominators.h" Index: lib/Transforms/Scalar/LoopStrengthReduce.cpp =================================================================== --- lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -68,7 +68,7 @@ #include "llvm/Analysis/IVUsers.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopPass.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Analysis/ScalarEvolutionExpander.h" #include "llvm/Analysis/ScalarEvolutionExpressions.h" Index: lib/Transforms/Scalar/LoopUnrollPass.cpp =================================================================== --- lib/Transforms/Scalar/LoopUnrollPass.cpp +++ lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -19,7 +19,7 @@ #include "llvm/Analysis/GlobalsModRef.h" #include "llvm/Analysis/InstructionSimplify.h" #include "llvm/Analysis/LoopPass.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Analysis/LoopUnrollAnalyzer.h" #include "llvm/Analysis/OptimizationDiagnosticInfo.h" #include "llvm/Analysis/ScalarEvolution.h" Index: tools/opt/NewPMDriver.cpp =================================================================== --- tools/opt/NewPMDriver.cpp +++ tools/opt/NewPMDriver.cpp @@ -17,7 +17,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/CGSCCPassManager.h" -#include "llvm/Analysis/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Bitcode/BitcodeWriterPass.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/IRPrintingPasses.h" Index: unittests/Analysis/CMakeLists.txt =================================================================== --- unittests/Analysis/CMakeLists.txt +++ unittests/Analysis/CMakeLists.txt @@ -13,7 +13,6 @@ CFGTest.cpp CGSCCPassManagerTest.cpp LazyCallGraphTest.cpp - LoopPassManagerTest.cpp MemoryBuiltinsTest.cpp ScalarEvolutionTest.cpp TBAATest.cpp Index: unittests/Transforms/CMakeLists.txt =================================================================== --- unittests/Transforms/CMakeLists.txt +++ unittests/Transforms/CMakeLists.txt @@ -1,2 +1,3 @@ add_subdirectory(IPO) +add_subdirectory(Scalar) add_subdirectory(Utils) Index: unittests/Transforms/Scalar/CMakeLists.txt =================================================================== --- /dev/null +++ unittests/Transforms/Scalar/CMakeLists.txt @@ -0,0 +1,12 @@ +set(LLVM_LINK_COMPONENTS + Analysis + AsmParser + Core + Support + ScalarOpts + TransformUtils + ) + +add_llvm_unittest(ScalarTests + LoopPassManagerTest.cpp + ) Index: unittests/Transforms/Scalar/LoopPassManagerTest.cpp =================================================================== --- unittests/Transforms/Scalar/LoopPassManagerTest.cpp +++ unittests/Transforms/Scalar/LoopPassManagerTest.cpp @@ -7,9 +7,9 @@ // //===----------------------------------------------------------------------===// +#include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/AssumptionCache.h" -#include "llvm/Analysis/LoopPassManager.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h"