[llvm] r272978 - [PM] Remove support for omitting the AnalysisManager argument to new

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 16 17:11:01 PDT 2016


Author: chandlerc
Date: Thu Jun 16 19:11:01 2016
New Revision: 272978

URL: http://llvm.org/viewvc/llvm-project?rev=272978&view=rev
Log:
[PM] Remove support for omitting the AnalysisManager argument to new
pass manager passes' `run` methods.

This removes a bunch of SFINAE goop from the pass manager and just
requires pass authors to accept `AnalysisManager<IRUnitT> &` as a dead
argument. This is a small price to pay for the simplicity of the system
as a whole, despite the noise that changing it causes at this stage.

This will also helpfull allow us to make the signature of the run
methods much more flexible for different kinds af passes to support
things like intelligently updating the pass's progression over IR units.

While this touches many, many, files, the changes are really boring.
Mostly made with the help of my trusty perl one liners.

Thanks to Sean and Hal for bouncing ideas for this with me in IRC.

Modified:
    llvm/trunk/include/llvm/Analysis/AssumptionCache.h
    llvm/trunk/include/llvm/Analysis/CallGraph.h
    llvm/trunk/include/llvm/Analysis/LazyCallGraph.h
    llvm/trunk/include/llvm/Analysis/LoopInfo.h
    llvm/trunk/include/llvm/Analysis/PostDominators.h
    llvm/trunk/include/llvm/Analysis/ProfileSummaryInfo.h
    llvm/trunk/include/llvm/Analysis/TargetLibraryInfo.h
    llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h
    llvm/trunk/include/llvm/Bitcode/BitcodeWriterPass.h
    llvm/trunk/include/llvm/IR/Dominators.h
    llvm/trunk/include/llvm/IR/IRPrintingPasses.h
    llvm/trunk/include/llvm/IR/PassManager.h
    llvm/trunk/include/llvm/IR/PassManagerInternal.h
    llvm/trunk/include/llvm/IR/Verifier.h
    llvm/trunk/include/llvm/Transforms/IPO/ConstantMerge.h
    llvm/trunk/include/llvm/Transforms/IPO/DeadArgumentElimination.h
    llvm/trunk/include/llvm/Transforms/IPO/ElimAvailExtern.h
    llvm/trunk/include/llvm/Transforms/IPO/ForceFunctionAttrs.h
    llvm/trunk/include/llvm/Transforms/IPO/GlobalDCE.h
    llvm/trunk/include/llvm/Transforms/IPO/StripDeadPrototypes.h
    llvm/trunk/include/llvm/Transforms/IPO/WholeProgramDevirt.h
    llvm/trunk/include/llvm/Transforms/Scalar/ADCE.h
    llvm/trunk/include/llvm/Transforms/Scalar/LowerAtomic.h
    llvm/trunk/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h
    llvm/trunk/include/llvm/Transforms/Scalar/Reassociate.h
    llvm/trunk/lib/Analysis/LoopInfo.cpp
    llvm/trunk/lib/Analysis/LoopPass.cpp
    llvm/trunk/lib/Analysis/PostDominators.cpp
    llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp
    llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp
    llvm/trunk/lib/Analysis/TargetTransformInfo.cpp
    llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp
    llvm/trunk/lib/IR/Dominators.cpp
    llvm/trunk/lib/IR/IRPrintingPasses.cpp
    llvm/trunk/lib/IR/Verifier.cpp
    llvm/trunk/lib/Passes/PassBuilder.cpp
    llvm/trunk/lib/Transforms/IPO/ConstantMerge.cpp
    llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
    llvm/trunk/lib/Transforms/IPO/ElimAvailExtern.cpp
    llvm/trunk/lib/Transforms/IPO/ForceFunctionAttrs.cpp
    llvm/trunk/lib/Transforms/IPO/GlobalDCE.cpp
    llvm/trunk/lib/Transforms/IPO/StripDeadPrototypes.cpp
    llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp
    llvm/trunk/lib/Transforms/Scalar/ADCE.cpp
    llvm/trunk/lib/Transforms/Scalar/LowerAtomic.cpp
    llvm/trunk/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp
    llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp
    llvm/trunk/unittests/Analysis/CGSCCPassManagerTest.cpp
    llvm/trunk/unittests/IR/PassManagerTest.cpp

Modified: llvm/trunk/include/llvm/Analysis/AssumptionCache.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AssumptionCache.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AssumptionCache.h (original)
+++ llvm/trunk/include/llvm/Analysis/AssumptionCache.h Thu Jun 16 19:11:01 2016
@@ -106,7 +106,9 @@ public:
   AssumptionAnalysis &operator=(const AssumptionAnalysis &RHS) { return *this; }
   AssumptionAnalysis &operator=(AssumptionAnalysis &&RHS) { return *this; }
 
-  AssumptionCache run(Function &F) { return AssumptionCache(F); }
+  AssumptionCache run(Function &F, FunctionAnalysisManager &) {
+    return AssumptionCache(F);
+  }
 };
 
 /// \brief Printer pass for the \c AssumptionAnalysis results.

Modified: llvm/trunk/include/llvm/Analysis/CallGraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CallGraph.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CallGraph.h (original)
+++ llvm/trunk/include/llvm/Analysis/CallGraph.h Thu Jun 16 19:11:01 2016
@@ -306,7 +306,7 @@ public:
   /// \brief Compute the \c CallGraph for the module \c M.
   ///
   /// The real work here is done in the \c CallGraph constructor.
-  CallGraph run(Module &M) { return CallGraph(M); }
+  CallGraph run(Module &M, ModuleAnalysisManager &) { return CallGraph(M); }
 };
 
 /// \brief Printer pass for the \c CallGraphAnalysis results.

Modified: llvm/trunk/include/llvm/Analysis/LazyCallGraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LazyCallGraph.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LazyCallGraph.h (original)
+++ llvm/trunk/include/llvm/Analysis/LazyCallGraph.h Thu Jun 16 19:11:01 2016
@@ -907,7 +907,9 @@ public:
   ///
   /// This just builds the set of entry points to the call graph. The rest is
   /// built lazily as it is walked.
-  LazyCallGraph run(Module &M) { return LazyCallGraph(M); }
+  LazyCallGraph run(Module &M, ModuleAnalysisManager &) {
+    return LazyCallGraph(M);
+  }
 };
 
 /// A pass which prints the call graph to a \c raw_ostream.

Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Thu Jun 16 19:11:01 2016
@@ -826,7 +826,7 @@ public:
   PrintLoopPass();
   PrintLoopPass(raw_ostream &OS, const std::string &Banner = "");
 
-  PreservedAnalyses run(Loop &L);
+  PreservedAnalyses run(Loop &L, AnalysisManager<Loop> &);
 };
 
 } // End llvm namespace

Modified: llvm/trunk/include/llvm/Analysis/PostDominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/PostDominators.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/PostDominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/PostDominators.h Thu Jun 16 19:11:01 2016
@@ -48,7 +48,7 @@ public:
 
   /// \brief Run the analysis pass over a function and produce a post dominator
   ///        tree.
-  PostDominatorTree run(Function &F);
+  PostDominatorTree run(Function &F, FunctionAnalysisManager &);
 };
 
 /// \brief Printer pass for the \c PostDominatorTree.

Modified: llvm/trunk/include/llvm/Analysis/ProfileSummaryInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ProfileSummaryInfo.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ProfileSummaryInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/ProfileSummaryInfo.h Thu Jun 16 19:11:01 2016
@@ -91,7 +91,7 @@ public:
     return *this;
   }
 
-  Result run(Module &M);
+  Result run(Module &M, ModuleAnalysisManager &);
 
 private:
   friend AnalysisInfoMixin<ProfileSummaryAnalysis>;

Modified: llvm/trunk/include/llvm/Analysis/TargetLibraryInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/TargetLibraryInfo.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/TargetLibraryInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/TargetLibraryInfo.h Thu Jun 16 19:11:01 2016
@@ -304,8 +304,8 @@ public:
     return *this;
   }
 
-  TargetLibraryInfo run(Module &M);
-  TargetLibraryInfo run(Function &F);
+  TargetLibraryInfo run(Module &M, ModuleAnalysisManager &);
+  TargetLibraryInfo run(Function &F, FunctionAnalysisManager &);
 
 private:
   friend AnalysisInfoMixin<TargetLibraryAnalysis>;

Modified: llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h Thu Jun 16 19:11:01 2016
@@ -995,7 +995,7 @@ public:
     return *this;
   }
 
-  Result run(const Function &F);
+  Result run(const Function &F, AnalysisManager<Function> &);
 
 private:
   friend AnalysisInfoMixin<TargetIRAnalysis>;

Modified: llvm/trunk/include/llvm/Bitcode/BitcodeWriterPass.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitcodeWriterPass.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/BitcodeWriterPass.h (original)
+++ llvm/trunk/include/llvm/Bitcode/BitcodeWriterPass.h Thu Jun 16 19:11:01 2016
@@ -16,12 +16,12 @@
 #define LLVM_BITCODE_BITCODEWRITERPASS_H
 
 #include "llvm/ADT/StringRef.h"
+#include "llvm/IR/PassManager.h"
 
 namespace llvm {
 class Module;
 class ModulePass;
 class raw_ostream;
-class PreservedAnalyses;
 
 /// \brief Create and return a pass that writes the module to the specified
 /// ostream. Note that this pass is designed for use with the legacy pass
@@ -67,7 +67,7 @@ public:
 
   /// \brief Run the bitcode writer pass, and output the module to the selected
   /// output stream.
-  PreservedAnalyses run(Module &M);
+  PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
 
   static StringRef name() { return "BitcodeWriterPass"; }
 };

Modified: llvm/trunk/include/llvm/IR/Dominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Dominators.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Dominators.h (original)
+++ llvm/trunk/include/llvm/IR/Dominators.h Thu Jun 16 19:11:01 2016
@@ -187,7 +187,7 @@ public:
   typedef DominatorTree Result;
 
   /// \brief Run the analysis pass over a function and produce a dominator tree.
-  DominatorTree run(Function &F);
+  DominatorTree run(Function &F, AnalysisManager<Function> &);
 };
 
 /// \brief Printer pass for the \c DominatorTree.

Modified: llvm/trunk/include/llvm/IR/IRPrintingPasses.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IRPrintingPasses.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/IRPrintingPasses.h (original)
+++ llvm/trunk/include/llvm/IR/IRPrintingPasses.h Thu Jun 16 19:11:01 2016
@@ -30,6 +30,7 @@ class Module;
 class ModulePass;
 class PreservedAnalyses;
 class raw_ostream;
+template <typename IRUnitT> class AnalysisManager;
 
 /// \brief Create and return a pass that writes the module to the specified
 /// \c raw_ostream.
@@ -67,7 +68,7 @@ public:
   PrintModulePass(raw_ostream &OS, const std::string &Banner = "",
                   bool ShouldPreserveUseListOrder = false);
 
-  PreservedAnalyses run(Module &M);
+  PreservedAnalyses run(Module &M, AnalysisManager<Module> &);
 
   static StringRef name() { return "PrintModulePass"; }
 };
@@ -84,7 +85,7 @@ public:
   PrintFunctionPass();
   PrintFunctionPass(raw_ostream &OS, const std::string &Banner = "");
 
-  PreservedAnalyses run(Function &F);
+  PreservedAnalyses run(Function &F, AnalysisManager<Function> &);
 
   static StringRef name() { return "PrintFunctionPass"; }
 };

Modified: llvm/trunk/include/llvm/IR/PassManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/PassManager.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/PassManager.h (original)
+++ llvm/trunk/include/llvm/IR/PassManager.h Thu Jun 16 19:11:01 2016
@@ -750,7 +750,7 @@ public:
   /// In debug builds, it will also assert that the analysis manager is empty
   /// as no queries should arrive at the function analysis manager prior to
   /// this analysis being requested.
-  Result run(IRUnitT &IR) { return Result(*AM); }
+  Result run(IRUnitT &IR, AnalysisManager<IRUnitT> &) { return Result(*AM); }
 
 private:
   friend AnalysisInfoMixin<
@@ -823,7 +823,7 @@ public:
   /// \brief Run the analysis pass and create our proxy result object.
   /// Nothing to see here, it just forwards the \c AM reference into the
   /// result.
-  Result run(IRUnitT &) { return Result(*AM); }
+  Result run(IRUnitT &, AnalysisManager<IRUnitT> &) { return Result(*AM); }
 
 private:
   friend AnalysisInfoMixin<
@@ -981,7 +981,8 @@ struct InvalidateAnalysisPass
 /// analysis passes to be re-run to produce fresh results if any are needed.
 struct InvalidateAllAnalysesPass : PassInfoMixin<InvalidateAllAnalysesPass> {
   /// \brief Run this pass over some unit of IR.
-  template <typename IRUnitT> PreservedAnalyses run(IRUnitT &Arg) {
+  template <typename IRUnitT>
+  PreservedAnalyses run(IRUnitT &, AnalysisManager<IRUnitT> &) {
     return PreservedAnalyses::none();
   }
 };

Modified: llvm/trunk/include/llvm/IR/PassManagerInternal.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/PassManagerInternal.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/PassManagerInternal.h (original)
+++ llvm/trunk/include/llvm/IR/PassManagerInternal.h Thu Jun 16 19:11:01 2016
@@ -46,42 +46,14 @@ template <typename IRUnitT> struct PassC
   virtual StringRef name() = 0;
 };
 
-/// \brief SFINAE metafunction for computing whether \c PassT has a run method
-/// accepting an \c AnalysisManager<IRUnitT>.
-template <typename IRUnitT, typename PassT, typename ResultT>
-class PassRunAcceptsAnalysisManager {
-  typedef char SmallType;
-  struct BigType {
-    char a, b;
-  };
-
-  template <typename T, ResultT (T::*)(IRUnitT &, AnalysisManager<IRUnitT> &)>
-  struct Checker;
-
-  template <typename T> static SmallType f(Checker<T, &T::run> *);
-  template <typename T> static BigType f(...);
-
-public:
-  enum { Value = sizeof(f<PassT>(nullptr)) == sizeof(SmallType) };
-};
-
 /// \brief A template wrapper used to implement the polymorphic API.
 ///
 /// Can be instantiated for any object which provides a \c run method accepting
-/// an \c IRUnitT. It requires the pass to be a copyable object. When the
-/// \c run method also accepts an \c AnalysisManager<IRUnitT>*, we pass it
-/// along.
+/// an \c IRUnitT& and an \c AnalysisManager<IRUnit>&. It requires the pass to
+/// be a copyable object. When the
 template <typename IRUnitT, typename PassT,
-          typename PreservedAnalysesT = PreservedAnalyses,
-          bool AcceptsAnalysisManager = PassRunAcceptsAnalysisManager<
-              IRUnitT, PassT, PreservedAnalysesT>::Value>
-struct PassModel;
-
-/// \brief Specialization of \c PassModel for passes that accept an analyis
-/// manager.
-template <typename IRUnitT, typename PassT, typename PreservedAnalysesT>
-struct PassModel<IRUnitT, PassT, PreservedAnalysesT, true>
-    : PassConcept<IRUnitT> {
+          typename PreservedAnalysesT = PreservedAnalyses>
+struct PassModel : PassConcept<IRUnitT> {
   explicit PassModel(PassT Pass) : Pass(std::move(Pass)) {}
   // We have to explicitly define all the special member functions because MSVC
   // refuses to generate them.
@@ -103,32 +75,6 @@ struct PassModel<IRUnitT, PassT, Preserv
   PassT Pass;
 };
 
-/// \brief Specialization of \c PassModel for passes that accept an analyis
-/// manager.
-template <typename IRUnitT, typename PassT, typename PreservedAnalysesT>
-struct PassModel<IRUnitT, PassT, PreservedAnalysesT, false>
-    : PassConcept<IRUnitT> {
-  explicit PassModel(PassT Pass) : Pass(std::move(Pass)) {}
-  // We have to explicitly define all the special member functions because MSVC
-  // refuses to generate them.
-  PassModel(const PassModel &Arg) : Pass(Arg.Pass) {}
-  PassModel(PassModel &&Arg) : Pass(std::move(Arg.Pass)) {}
-  friend void swap(PassModel &LHS, PassModel &RHS) {
-    using std::swap;
-    swap(LHS.Pass, RHS.Pass);
-  }
-  PassModel &operator=(PassModel RHS) {
-    swap(*this, RHS);
-    return *this;
-  }
-
-  PreservedAnalysesT run(IRUnitT &IR, AnalysisManager<IRUnitT> &) override {
-    return Pass.run(IR);
-  }
-  StringRef name() override { return PassT::name(); }
-  PassT Pass;
-};
-
 /// \brief Abstract concept of an analysis result.
 ///
 /// This concept is parameterized over the IR unit that this result pertains
@@ -261,17 +207,10 @@ template <typename IRUnitT> struct Analy
 /// \brief Wrapper to model the analysis pass concept.
 ///
 /// Can wrap any type which implements a suitable \c run method. The method
-/// must accept the IRUnitT as an argument and produce an object which can be
-/// wrapped in a \c AnalysisResultModel.
-template <typename IRUnitT, typename PassT,
-          bool AcceptsAnalysisManager = PassRunAcceptsAnalysisManager<
-              IRUnitT, PassT, typename PassT::Result>::Value>
-struct AnalysisPassModel;
-
-/// \brief Specialization of \c AnalysisPassModel which passes an
-/// \c AnalysisManager to PassT's run method.
+/// must accept an \c IRUnitT& and an \c AnalysisManager<IRUnitT>& as arguments
+/// and produce an object which can be wrapped in a \c AnalysisResultModel.
 template <typename IRUnitT, typename PassT>
-struct AnalysisPassModel<IRUnitT, PassT, true> : AnalysisPassConcept<IRUnitT> {
+struct AnalysisPassModel : AnalysisPassConcept<IRUnitT> {
   explicit AnalysisPassModel(PassT Pass) : Pass(std::move(Pass)) {}
   // We have to explicitly define all the special member functions because MSVC
   // refuses to generate them.
@@ -299,44 +238,6 @@ struct AnalysisPassModel<IRUnitT, PassT,
   }
 
   /// \brief The model delegates to a static \c PassT::name method.
-  ///
-  /// The returned string ref must point to constant immutable data!
-  StringRef name() override { return PassT::name(); }
-
-  PassT Pass;
-};
-
-/// \brief Specialization of \c AnalysisPassModel which does not pass an
-/// \c AnalysisManager to PassT's run method.
-template <typename IRUnitT, typename PassT>
-struct AnalysisPassModel<IRUnitT, PassT, false> : AnalysisPassConcept<IRUnitT> {
-  explicit AnalysisPassModel(PassT Pass) : Pass(std::move(Pass)) {}
-  // We have to explicitly define all the special member functions because MSVC
-  // refuses to generate them.
-  AnalysisPassModel(const AnalysisPassModel &Arg) : Pass(Arg.Pass) {}
-  AnalysisPassModel(AnalysisPassModel &&Arg) : Pass(std::move(Arg.Pass)) {}
-  friend void swap(AnalysisPassModel &LHS, AnalysisPassModel &RHS) {
-    using std::swap;
-    swap(LHS.Pass, RHS.Pass);
-  }
-  AnalysisPassModel &operator=(AnalysisPassModel RHS) {
-    swap(*this, RHS);
-    return *this;
-  }
-
-  // FIXME: Replace PassT::Result with type traits when we use C++11.
-  typedef AnalysisResultModel<IRUnitT, PassT, typename PassT::Result>
-      ResultModelT;
-
-  /// \brief The model delegates to the \c PassT::run method.
-  ///
-  /// The return is wrapped in an \c AnalysisResultModel.
-  std::unique_ptr<AnalysisResultConcept<IRUnitT>>
-  run(IRUnitT &IR, AnalysisManager<IRUnitT> &) override {
-    return make_unique<ResultModelT>(Pass.run(IR));
-  }
-
-  /// \brief The model delegates to a static \c PassT::name method.
   ///
   /// The returned string ref must point to constant immutable data!
   StringRef name() override { return PassT::name(); }

Modified: llvm/trunk/include/llvm/IR/Verifier.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Verifier.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Verifier.h (original)
+++ llvm/trunk/include/llvm/IR/Verifier.h Thu Jun 16 19:11:01 2016
@@ -65,8 +65,8 @@ public:
     bool IRBroken, DebugInfoBroken;
   };
   static void *ID() { return (void *)&PassID; }
-  Result run(Module &M);
-  Result run(Function &F);
+  Result run(Module &M, ModuleAnalysisManager &);
+  Result run(Function &F, FunctionAnalysisManager &);
 };
 
 /// Check a module for errors, but report debug info errors separately.

Modified: llvm/trunk/include/llvm/Transforms/IPO/ConstantMerge.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/ConstantMerge.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/ConstantMerge.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/ConstantMerge.h Thu Jun 16 19:11:01 2016
@@ -28,7 +28,7 @@ namespace llvm {
 /// A pass that merges duplicate global constants into a single constant.
 class ConstantMergePass : public PassInfoMixin<ConstantMergePass> {
 public:
-  PreservedAnalyses run(Module &M);
+  PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
 };
 }
 

Modified: llvm/trunk/include/llvm/Transforms/IPO/DeadArgumentElimination.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/DeadArgumentElimination.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/DeadArgumentElimination.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/DeadArgumentElimination.h Thu Jun 16 19:11:01 2016
@@ -110,7 +110,7 @@ public:
 public:
   DeadArgumentEliminationPass(bool ShouldHackArguments_ = false)
       : ShouldHackArguments(ShouldHackArguments_) {}
-  PreservedAnalyses run(Module &M);
+  PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
 
 private:
   Liveness MarkIfNotLive(RetOrArg Use, UseVector &MaybeLiveUses);

Modified: llvm/trunk/include/llvm/Transforms/IPO/ElimAvailExtern.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/ElimAvailExtern.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/ElimAvailExtern.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/ElimAvailExtern.h Thu Jun 16 19:11:01 2016
@@ -24,7 +24,7 @@ namespace llvm {
 class EliminateAvailableExternallyPass
     : public PassInfoMixin<EliminateAvailableExternallyPass> {
 public:
-  PreservedAnalyses run(Module &M);
+  PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
 };
 }
 

Modified: llvm/trunk/include/llvm/Transforms/IPO/ForceFunctionAttrs.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/ForceFunctionAttrs.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/ForceFunctionAttrs.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/ForceFunctionAttrs.h Thu Jun 16 19:11:01 2016
@@ -22,7 +22,7 @@ namespace llvm {
 /// Pass which forces specific function attributes into the IR, primarily as
 /// a debugging tool.
 struct ForceFunctionAttrsPass : PassInfoMixin<ForceFunctionAttrsPass> {
-  PreservedAnalyses run(Module &M);
+  PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
 };
 
 /// Create a legacy pass manager instance of a pass to force function attrs.

Modified: llvm/trunk/include/llvm/Transforms/IPO/GlobalDCE.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/GlobalDCE.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/GlobalDCE.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/GlobalDCE.h Thu Jun 16 19:11:01 2016
@@ -27,7 +27,7 @@ namespace llvm {
 /// Pass to remove unused function declarations.
 class GlobalDCEPass : public PassInfoMixin<GlobalDCEPass> {
 public:
-  PreservedAnalyses run(Module &M);
+  PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
 
 private:
   SmallPtrSet<GlobalValue*, 32> AliveGlobals;

Modified: llvm/trunk/include/llvm/Transforms/IPO/StripDeadPrototypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/StripDeadPrototypes.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/StripDeadPrototypes.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/StripDeadPrototypes.h Thu Jun 16 19:11:01 2016
@@ -24,7 +24,7 @@ namespace llvm {
 
 /// Pass to remove unused function declarations.
 struct StripDeadPrototypesPass : PassInfoMixin<StripDeadPrototypesPass> {
-  PreservedAnalyses run(Module &M);
+  PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
 };
 
 }

Modified: llvm/trunk/include/llvm/Transforms/IPO/WholeProgramDevirt.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/WholeProgramDevirt.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/WholeProgramDevirt.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/WholeProgramDevirt.h Thu Jun 16 19:11:01 2016
@@ -214,7 +214,7 @@ void setAfterReturnValues(MutableArrayRe
 } // end namespace wholeprogramdevirt
 
 struct WholeProgramDevirtPass : public PassInfoMixin<WholeProgramDevirtPass> {
-  PreservedAnalyses run(Module &M);
+  PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
 };
 
 } // end namespace llvm

Modified: llvm/trunk/include/llvm/Transforms/Scalar/ADCE.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar/ADCE.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar/ADCE.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar/ADCE.h Thu Jun 16 19:11:01 2016
@@ -29,7 +29,7 @@ namespace llvm {
 /// dead computations that other DCE passes do not catch, particularly involving
 /// loop computations.
 struct ADCEPass : PassInfoMixin<ADCEPass> {
-  PreservedAnalyses run(Function &F);
+  PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
 };
 }
 

Modified: llvm/trunk/include/llvm/Transforms/Scalar/LowerAtomic.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar/LowerAtomic.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar/LowerAtomic.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar/LowerAtomic.h Thu Jun 16 19:11:01 2016
@@ -22,7 +22,7 @@ namespace llvm {
 /// A pass that lowers atomic intrinsic into non-atomic intrinsics.
 class LowerAtomicPass : public PassInfoMixin<LowerAtomicPass> {
 public:
-  PreservedAnalyses run(Function &F);
+  PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
 };
 }
 

Modified: llvm/trunk/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h Thu Jun 16 19:11:01 2016
@@ -29,7 +29,7 @@ struct LowerExpectIntrinsicPass : PassIn
   /// of the probabilities and frequencies of the CFG. After running this pass,
   /// no more expect intrinsics remain, allowing the rest of the optimizer to
   /// ignore them.
-  PreservedAnalyses run(Function &F);
+  PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
 };
 
 }

Modified: llvm/trunk/include/llvm/Transforms/Scalar/Reassociate.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar/Reassociate.h?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar/Reassociate.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar/Reassociate.h Thu Jun 16 19:11:01 2016
@@ -62,7 +62,7 @@ class ReassociatePass : public PassInfoM
   bool MadeChange;
 
 public:
-  PreservedAnalyses run(Function &F);
+  PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
 
 private:
   void BuildRankMap(Function &F, ReversePostOrderTraversal<Function *> &RPOT);

Modified: llvm/trunk/lib/Analysis/LoopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopInfo.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopInfo.cpp Thu Jun 16 19:11:01 2016
@@ -670,7 +670,7 @@ PrintLoopPass::PrintLoopPass() : OS(dbgs
 PrintLoopPass::PrintLoopPass(raw_ostream &OS, const std::string &Banner)
     : OS(OS), Banner(Banner) {}
 
-PreservedAnalyses PrintLoopPass::run(Loop &L) {
+PreservedAnalyses PrintLoopPass::run(Loop &L, AnalysisManager<Loop> &) {
   OS << Banner;
   for (auto *Block : L.blocks())
     if (Block)

Modified: llvm/trunk/lib/Analysis/LoopPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopPass.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopPass.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopPass.cpp Thu Jun 16 19:11:01 2016
@@ -46,8 +46,10 @@ public:
     auto BBI = find_if(L->blocks().begin(), L->blocks().end(),
                        [](BasicBlock *BB) { return BB; });
     if (BBI != L->blocks().end() &&
-        isFunctionInPrintList((*BBI)->getParent()->getName()))
-      P.run(*L);
+        isFunctionInPrintList((*BBI)->getParent()->getName())) {
+      AnalysisManager<Loop> DummyLAM;
+      P.run(*L, DummyLAM);
+    }
     return false;
   }
 };

Modified: llvm/trunk/lib/Analysis/PostDominators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PostDominators.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/PostDominators.cpp (original)
+++ llvm/trunk/lib/Analysis/PostDominators.cpp Thu Jun 16 19:11:01 2016
@@ -46,7 +46,8 @@ FunctionPass* llvm::createPostDomTree()
 
 char PostDominatorTreeAnalysis::PassID;
 
-PostDominatorTree PostDominatorTreeAnalysis::run(Function &F) {
+PostDominatorTree PostDominatorTreeAnalysis::run(Function &F,
+                                                 FunctionAnalysisManager &) {
   PostDominatorTree PDT;
   PDT.recalculate(F);
   return PDT;

Modified: llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp Thu Jun 16 19:11:01 2016
@@ -140,7 +140,8 @@ ProfileSummaryInfoWrapperPass::ProfileSu
 }
 
 char ProfileSummaryAnalysis::PassID;
-ProfileSummaryInfo ProfileSummaryAnalysis::run(Module &M) {
+ProfileSummaryInfo ProfileSummaryAnalysis::run(Module &M,
+                                               ModuleAnalysisManager &) {
   return ProfileSummaryInfo(M);
 }
 

Modified: llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp Thu Jun 16 19:11:01 2016
@@ -1127,14 +1127,16 @@ StringRef TargetLibraryInfoImpl::getScal
   return I->ScalarFnName;
 }
 
-TargetLibraryInfo TargetLibraryAnalysis::run(Module &M) {
+TargetLibraryInfo TargetLibraryAnalysis::run(Module &M,
+                                             ModuleAnalysisManager &) {
   if (PresetInfoImpl)
     return TargetLibraryInfo(*PresetInfoImpl);
 
   return TargetLibraryInfo(lookupInfoImpl(Triple(M.getTargetTriple())));
 }
 
-TargetLibraryInfo TargetLibraryAnalysis::run(Function &F) {
+TargetLibraryInfo TargetLibraryAnalysis::run(Function &F,
+                                             FunctionAnalysisManager &) {
   if (PresetInfoImpl)
     return TargetLibraryInfo(*PresetInfoImpl);
 

Modified: llvm/trunk/lib/Analysis/TargetTransformInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/TargetTransformInfo.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/TargetTransformInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/TargetTransformInfo.cpp Thu Jun 16 19:11:01 2016
@@ -404,7 +404,8 @@ TargetIRAnalysis::TargetIRAnalysis(
     std::function<Result(const Function &)> TTICallback)
     : TTICallback(std::move(TTICallback)) {}
 
-TargetIRAnalysis::Result TargetIRAnalysis::run(const Function &F) {
+TargetIRAnalysis::Result TargetIRAnalysis::run(const Function &F,
+                                               AnalysisManager<Function> &) {
   return TTICallback(F);
 }
 
@@ -435,7 +436,8 @@ TargetTransformInfoWrapperPass::TargetTr
 }
 
 TargetTransformInfo &TargetTransformInfoWrapperPass::getTTI(const Function &F) {
-  TTI = TIRA.run(F);
+  AnalysisManager<Function> DummyFAM;
+  TTI = TIRA.run(F, DummyFAM);
   return *TTI;
 }
 

Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp Thu Jun 16 19:11:01 2016
@@ -19,7 +19,7 @@
 #include "llvm/Pass.h"
 using namespace llvm;
 
-PreservedAnalyses BitcodeWriterPass::run(Module &M) {
+PreservedAnalyses BitcodeWriterPass::run(Module &M, ModuleAnalysisManager &) {
   std::unique_ptr<ModuleSummaryIndex> Index;
   if (EmitSummaryIndex)
     Index = ModuleSummaryIndexBuilder(&M).takeIndex();

Modified: llvm/trunk/lib/IR/Dominators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Dominators.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Dominators.cpp (original)
+++ llvm/trunk/lib/IR/Dominators.cpp Thu Jun 16 19:11:01 2016
@@ -300,7 +300,8 @@ void DominatorTree::verifyDomTree() cons
 //
 //===----------------------------------------------------------------------===//
 
-DominatorTree DominatorTreeAnalysis::run(Function &F) {
+DominatorTree DominatorTreeAnalysis::run(Function &F,
+                                         AnalysisManager<Function> &) {
   DominatorTree DT;
   DT.recalculate(F);
   return DT;

Modified: llvm/trunk/lib/IR/IRPrintingPasses.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/IRPrintingPasses.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/IR/IRPrintingPasses.cpp (original)
+++ llvm/trunk/lib/IR/IRPrintingPasses.cpp Thu Jun 16 19:11:01 2016
@@ -26,7 +26,7 @@ PrintModulePass::PrintModulePass(raw_ost
     : OS(OS), Banner(Banner),
       ShouldPreserveUseListOrder(ShouldPreserveUseListOrder) {}
 
-PreservedAnalyses PrintModulePass::run(Module &M) {
+PreservedAnalyses PrintModulePass::run(Module &M, AnalysisManager<Module> &) {
   OS << Banner;
   if (llvm::isFunctionInPrintList("*"))
     M.print(OS, nullptr, ShouldPreserveUseListOrder);
@@ -42,7 +42,8 @@ PrintFunctionPass::PrintFunctionPass() :
 PrintFunctionPass::PrintFunctionPass(raw_ostream &OS, const std::string &Banner)
     : OS(OS), Banner(Banner) {}
 
-PreservedAnalyses PrintFunctionPass::run(Function &F) {
+PreservedAnalyses PrintFunctionPass::run(Function &F,
+                                         AnalysisManager<Function> &) {
   if (isFunctionInPrintList(F.getName()))
     OS << Banner << static_cast<Value &>(F);
   return PreservedAnalyses::all();
@@ -61,7 +62,8 @@ public:
       : ModulePass(ID), P(OS, Banner, ShouldPreserveUseListOrder) {}
 
   bool runOnModule(Module &M) override {
-    P.run(M);
+    ModuleAnalysisManager DummyMAM;
+    P.run(M, DummyMAM);
     return false;
   }
 
@@ -81,7 +83,8 @@ public:
 
   // This pass just prints a banner followed by the function as it's processed.
   bool runOnFunction(Function &F) override {
-    P.run(F);
+    FunctionAnalysisManager DummyFAM;
+    P.run(F, DummyFAM);
     return false;
   }
 

Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Thu Jun 16 19:11:01 2016
@@ -4512,13 +4512,15 @@ FunctionPass *llvm::createVerifierPass(b
 }
 
 char VerifierAnalysis::PassID;
-VerifierAnalysis::Result VerifierAnalysis::run(Module &M) {
+VerifierAnalysis::Result VerifierAnalysis::run(Module &M,
+                                               ModuleAnalysisManager &) {
   Result Res;
   Res.IRBroken = llvm::verifyModule(M, &dbgs(), &Res.DebugInfoBroken);
   return Res;
 }
 
-VerifierAnalysis::Result VerifierAnalysis::run(Function &F) {
+VerifierAnalysis::Result VerifierAnalysis::run(Function &F,
+                                               FunctionAnalysisManager &) {
   return { llvm::verifyFunction(F, &dbgs()), false };
 }
 

Modified: llvm/trunk/lib/Passes/PassBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassBuilder.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/Passes/PassBuilder.cpp (original)
+++ llvm/trunk/lib/Passes/PassBuilder.cpp Thu Jun 16 19:11:01 2016
@@ -105,7 +105,9 @@ namespace {
 
 /// \brief No-op module pass which does nothing.
 struct NoOpModulePass {
-  PreservedAnalyses run(Module &M) { return PreservedAnalyses::all(); }
+  PreservedAnalyses run(Module &M, AnalysisManager<Module> &) {
+    return PreservedAnalyses::all();
+  }
   static StringRef name() { return "NoOpModulePass"; }
 };
 
@@ -116,13 +118,14 @@ class NoOpModuleAnalysis : public Analys
 
 public:
   struct Result {};
-  Result run(Module &) { return Result(); }
+  Result run(Module &, AnalysisManager<Module> &) { return Result(); }
   static StringRef name() { return "NoOpModuleAnalysis"; }
 };
 
 /// \brief No-op CGSCC pass which does nothing.
 struct NoOpCGSCCPass {
-  PreservedAnalyses run(LazyCallGraph::SCC &C) {
+  PreservedAnalyses run(LazyCallGraph::SCC &C,
+                        AnalysisManager<LazyCallGraph::SCC> &) {
     return PreservedAnalyses::all();
   }
   static StringRef name() { return "NoOpCGSCCPass"; }
@@ -135,13 +138,17 @@ class NoOpCGSCCAnalysis : public Analysi
 
 public:
   struct Result {};
-  Result run(LazyCallGraph::SCC &) { return Result(); }
+  Result run(LazyCallGraph::SCC &, AnalysisManager<LazyCallGraph::SCC> &) {
+    return Result();
+  }
   static StringRef name() { return "NoOpCGSCCAnalysis"; }
 };
 
 /// \brief No-op function pass which does nothing.
 struct NoOpFunctionPass {
-  PreservedAnalyses run(Function &F) { return PreservedAnalyses::all(); }
+  PreservedAnalyses run(Function &F, AnalysisManager<Function> &) {
+    return PreservedAnalyses::all();
+  }
   static StringRef name() { return "NoOpFunctionPass"; }
 };
 
@@ -152,13 +159,15 @@ class NoOpFunctionAnalysis : public Anal
 
 public:
   struct Result {};
-  Result run(Function &) { return Result(); }
+  Result run(Function &, AnalysisManager<Function> &) { return Result(); }
   static StringRef name() { return "NoOpFunctionAnalysis"; }
 };
 
 /// \brief No-op loop pass which does nothing.
 struct NoOpLoopPass {
-  PreservedAnalyses run(Loop &L) { return PreservedAnalyses::all(); }
+  PreservedAnalyses run(Loop &L, AnalysisManager<Loop> &) {
+    return PreservedAnalyses::all();
+  }
   static StringRef name() { return "NoOpLoopPass"; }
 };
 
@@ -169,7 +178,7 @@ class NoOpLoopAnalysis : public Analysis
 
 public:
   struct Result {};
-  Result run(Loop &) { return Result(); }
+  Result run(Loop &, AnalysisManager<Loop> &) { return Result(); }
   static StringRef name() { return "NoOpLoopAnalysis"; }
 };
 

Modified: llvm/trunk/lib/Transforms/IPO/ConstantMerge.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ConstantMerge.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/ConstantMerge.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/ConstantMerge.cpp Thu Jun 16 19:11:01 2016
@@ -192,7 +192,7 @@ static bool mergeConstants(Module &M) {
   }
 }
 
-PreservedAnalyses ConstantMergePass::run(Module &M) {
+PreservedAnalyses ConstantMergePass::run(Module &M, ModuleAnalysisManager &) {
   if (!mergeConstants(M))
     return PreservedAnalyses::all();
   return PreservedAnalyses::none();

Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Thu Jun 16 19:11:01 2016
@@ -64,7 +64,8 @@ namespace {
       if (skipModule(M))
         return false;
       DeadArgumentEliminationPass DAEP(ShouldHackArguments());
-      PreservedAnalyses PA = DAEP.run(M);
+      ModuleAnalysisManager DummyMAM;
+      PreservedAnalyses PA = DAEP.run(M, DummyMAM);
       return !PA.areAllPreserved();
     }
 
@@ -1029,7 +1030,8 @@ bool DeadArgumentEliminationPass::Remove
   return true;
 }
 
-PreservedAnalyses DeadArgumentEliminationPass::run(Module &M) {
+PreservedAnalyses DeadArgumentEliminationPass::run(Module &M,
+                                                   ModuleAnalysisManager &) {
   bool Changed = false;
 
   // First pass: Do a simple check to see if any functions can have their "..."

Modified: llvm/trunk/lib/Transforms/IPO/ElimAvailExtern.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ElimAvailExtern.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/ElimAvailExtern.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/ElimAvailExtern.cpp Thu Jun 16 19:11:01 2016
@@ -61,7 +61,8 @@ static bool eliminateAvailableExternally
   return Changed;
 }
 
-PreservedAnalyses EliminateAvailableExternallyPass::run(Module &M) {
+PreservedAnalyses
+EliminateAvailableExternallyPass::run(Module &M, ModuleAnalysisManager &) {
   if (!eliminateAvailableExternally(M))
     return PreservedAnalyses::all();
   return PreservedAnalyses::none();

Modified: llvm/trunk/lib/Transforms/IPO/ForceFunctionAttrs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ForceFunctionAttrs.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/ForceFunctionAttrs.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/ForceFunctionAttrs.cpp Thu Jun 16 19:11:01 2016
@@ -80,7 +80,8 @@ static void addForcedAttributes(Function
   }
 }
 
-PreservedAnalyses ForceFunctionAttrsPass::run(Module &M) {
+PreservedAnalyses ForceFunctionAttrsPass::run(Module &M,
+                                              ModuleAnalysisManager &) {
   if (ForceAttributes.empty())
     return PreservedAnalyses::all();
 

Modified: llvm/trunk/lib/Transforms/IPO/GlobalDCE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalDCE.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/GlobalDCE.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/GlobalDCE.cpp Thu Jun 16 19:11:01 2016
@@ -50,7 +50,8 @@ namespace {
       if (skipModule(M))
         return false;
 
-      auto PA = Impl.run(M);
+      ModuleAnalysisManager DummyMAM;
+      auto PA = Impl.run(M, DummyMAM);
       return !PA.areAllPreserved();
     }
 
@@ -77,7 +78,7 @@ static bool isEmptyFunction(Function *F)
   return RI.getReturnValue() == nullptr;
 }
 
-PreservedAnalyses GlobalDCEPass::run(Module &M) {
+PreservedAnalyses GlobalDCEPass::run(Module &M, ModuleAnalysisManager &) {
   bool Changed = false;
 
   // Remove empty functions from the global ctors list.

Modified: llvm/trunk/lib/Transforms/IPO/StripDeadPrototypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/StripDeadPrototypes.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/StripDeadPrototypes.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/StripDeadPrototypes.cpp Thu Jun 16 19:11:01 2016
@@ -53,7 +53,8 @@ static bool stripDeadPrototypes(Module &
   return MadeChange;
 }
 
-PreservedAnalyses StripDeadPrototypesPass::run(Module &M) {
+PreservedAnalyses StripDeadPrototypesPass::run(Module &M,
+                                               ModuleAnalysisManager &) {
   if (stripDeadPrototypes(M))
     return PreservedAnalyses::none();
   return PreservedAnalyses::all();

Modified: llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp Thu Jun 16 19:11:01 2016
@@ -280,7 +280,8 @@ ModulePass *llvm::createWholeProgramDevi
   return new WholeProgramDevirt;
 }
 
-PreservedAnalyses WholeProgramDevirtPass::run(Module &M) {
+PreservedAnalyses WholeProgramDevirtPass::run(Module &M,
+                                              ModuleAnalysisManager &) {
   if (!DevirtModule(M).run())
     return PreservedAnalyses::all();
   return PreservedAnalyses::none();

Modified: llvm/trunk/lib/Transforms/Scalar/ADCE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ADCE.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/ADCE.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Thu Jun 16 19:11:01 2016
@@ -145,7 +145,7 @@ static bool aggressiveDCE(Function& F) {
   return !Worklist.empty();
 }
 
-PreservedAnalyses ADCEPass::run(Function &F) {
+PreservedAnalyses ADCEPass::run(Function &F, FunctionAnalysisManager &) {
   if (!aggressiveDCE(F))
     return PreservedAnalyses::all();
 

Modified: llvm/trunk/lib/Transforms/Scalar/LowerAtomic.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LowerAtomic.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LowerAtomic.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LowerAtomic.cpp Thu Jun 16 19:11:01 2016
@@ -139,7 +139,7 @@ static bool lowerAtomics(Function &F) {
   return Changed;
 }
 
-PreservedAnalyses LowerAtomicPass::run(Function &F) {
+PreservedAnalyses LowerAtomicPass::run(Function &F, FunctionAnalysisManager &) {
   if (lowerAtomics(F))
     return PreservedAnalyses::none();
   return PreservedAnalyses::all();
@@ -157,7 +157,8 @@ public:
   bool runOnFunction(Function &F) override {
     if (skipFunction(F))
       return false;
-    auto PA = Impl.run(F);
+    FunctionAnalysisManager DummyFAM;
+    auto PA = Impl.run(F, DummyFAM);
     return !PA.areAllPreserved();
   }
 

Modified: llvm/trunk/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp Thu Jun 16 19:11:01 2016
@@ -170,7 +170,8 @@ static bool lowerExpectIntrinsic(Functio
   return Changed;
 }
 
-PreservedAnalyses LowerExpectIntrinsicPass::run(Function &F) {
+PreservedAnalyses LowerExpectIntrinsicPass::run(Function &F,
+                                                FunctionAnalysisManager &) {
   if (lowerExpectIntrinsic(F))
     return PreservedAnalyses::none();
 

Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Thu Jun 16 19:11:01 2016
@@ -2173,7 +2173,7 @@ void ReassociatePass::ReassociateExpress
   RewriteExprTree(I, Ops);
 }
 
-PreservedAnalyses ReassociatePass::run(Function &F) {
+PreservedAnalyses ReassociatePass::run(Function &F, FunctionAnalysisManager &) {
   // Reassociate needs for each instruction to have its operands already
   // processed, so we first perform a RPOT of the basic blocks so that
   // when we process a basic block, all its dominators have been processed
@@ -2251,7 +2251,8 @@ namespace {
       if (skipFunction(F))
         return false;
 
-      auto PA = Impl.run(F);
+      FunctionAnalysisManager DummyFAM;
+      auto PA = Impl.run(F, DummyFAM);
       return !PA.areAllPreserved();
     }
 

Modified: llvm/trunk/unittests/Analysis/CGSCCPassManagerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/CGSCCPassManagerTest.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/unittests/Analysis/CGSCCPassManagerTest.cpp (original)
+++ llvm/trunk/unittests/Analysis/CGSCCPassManagerTest.cpp Thu Jun 16 19:11:01 2016
@@ -199,7 +199,7 @@ struct TestSCCPass {
 struct TestFunctionPass {
   TestFunctionPass(int &RunCount) : RunCount(RunCount) {}
 
-  PreservedAnalyses run(Function &M) {
+  PreservedAnalyses run(Function &F, AnalysisManager<Function> &) {
     ++RunCount;
     return PreservedAnalyses::none();
   }

Modified: llvm/trunk/unittests/IR/PassManagerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/PassManagerTest.cpp?rev=272978&r1=272977&r2=272978&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/PassManagerTest.cpp (original)
+++ llvm/trunk/unittests/IR/PassManagerTest.cpp Thu Jun 16 19:11:01 2016
@@ -77,7 +77,7 @@ char TestModuleAnalysis::PassID;
 struct TestModulePass : PassInfoMixin<TestModulePass> {
   TestModulePass(int &RunCount) : RunCount(RunCount) {}
 
-  PreservedAnalyses run(Module &M) {
+  PreservedAnalyses run(Module &M, ModuleAnalysisManager &) {
     ++RunCount;
     return PreservedAnalyses::none();
   }
@@ -86,7 +86,9 @@ struct TestModulePass : PassInfoMixin<Te
 };
 
 struct TestPreservingModulePass : PassInfoMixin<TestPreservingModulePass> {
-  PreservedAnalyses run(Module &M) { return PreservedAnalyses::all(); }
+  PreservedAnalyses run(Module &M, ModuleAnalysisManager &) {
+    return PreservedAnalyses::all();
+  }
 };
 
 struct TestMinPreservingModulePass
@@ -145,7 +147,7 @@ struct TestInvalidationFunctionPass
     : PassInfoMixin<TestInvalidationFunctionPass> {
   TestInvalidationFunctionPass(StringRef FunctionName) : Name(FunctionName) {}
 
-  PreservedAnalyses run(Function &F) {
+  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM) {
     return F.getName() == Name ? PreservedAnalyses::none()
                                : PreservedAnalyses::all();
   }




More information about the llvm-commits mailing list