[llvm] r263219 - [PM] Make the AnalysisManager parameter to run methods a reference.

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 11 03:05:25 PST 2016


Author: chandlerc
Date: Fri Mar 11 05:05:24 2016
New Revision: 263219

URL: http://llvm.org/viewvc/llvm-project?rev=263219&view=rev
Log:
[PM] Make the AnalysisManager parameter to run methods a reference.

This was originally a pointer to support pass managers which didn't use
AnalysisManagers. However, that doesn't realistically come up much and
the complexity of supporting it doesn't really make sense.

In fact, *many* parts of the pass manager were just assuming the pointer
was never null already. This at least makes it much more explicit and
clear.

Modified:
    llvm/trunk/include/llvm/Analysis/AliasAnalysis.h
    llvm/trunk/include/llvm/Analysis/AliasAnalysisEvaluator.h
    llvm/trunk/include/llvm/Analysis/AssumptionCache.h
    llvm/trunk/include/llvm/Analysis/BasicAliasAnalysis.h
    llvm/trunk/include/llvm/Analysis/CFLAliasAnalysis.h
    llvm/trunk/include/llvm/Analysis/CGSCCPassManager.h
    llvm/trunk/include/llvm/Analysis/CallGraph.h
    llvm/trunk/include/llvm/Analysis/DominanceFrontier.h
    llvm/trunk/include/llvm/Analysis/GlobalsModRef.h
    llvm/trunk/include/llvm/Analysis/LazyCallGraph.h
    llvm/trunk/include/llvm/Analysis/LoopInfo.h
    llvm/trunk/include/llvm/Analysis/LoopPassManager.h
    llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h
    llvm/trunk/include/llvm/Analysis/ObjCARCAliasAnalysis.h
    llvm/trunk/include/llvm/Analysis/PostDominators.h
    llvm/trunk/include/llvm/Analysis/RegionInfo.h
    llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
    llvm/trunk/include/llvm/Analysis/ScalarEvolutionAliasAnalysis.h
    llvm/trunk/include/llvm/Analysis/ScopedNoAliasAA.h
    llvm/trunk/include/llvm/Analysis/TypeBasedAliasAnalysis.h
    llvm/trunk/include/llvm/IR/Dominators.h
    llvm/trunk/include/llvm/IR/PassManager.h
    llvm/trunk/include/llvm/IR/PassManagerInternal.h
    llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h
    llvm/trunk/include/llvm/Transforms/IPO/InferFunctionAttrs.h
    llvm/trunk/include/llvm/Transforms/InstCombine/InstCombine.h
    llvm/trunk/include/llvm/Transforms/Scalar/EarlyCSE.h
    llvm/trunk/include/llvm/Transforms/Scalar/GVN.h
    llvm/trunk/include/llvm/Transforms/Scalar/SROA.h
    llvm/trunk/include/llvm/Transforms/Scalar/SimplifyCFG.h
    llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp
    llvm/trunk/lib/Analysis/AssumptionCache.cpp
    llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
    llvm/trunk/lib/Analysis/CFLAliasAnalysis.cpp
    llvm/trunk/lib/Analysis/CallGraph.cpp
    llvm/trunk/lib/Analysis/DominanceFrontier.cpp
    llvm/trunk/lib/Analysis/GlobalsModRef.cpp
    llvm/trunk/lib/Analysis/LazyCallGraph.cpp
    llvm/trunk/lib/Analysis/LoopInfo.cpp
    llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
    llvm/trunk/lib/Analysis/ObjCARCAliasAnalysis.cpp
    llvm/trunk/lib/Analysis/PostDominators.cpp
    llvm/trunk/lib/Analysis/RegionInfo.cpp
    llvm/trunk/lib/Analysis/ScalarEvolution.cpp
    llvm/trunk/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp
    llvm/trunk/lib/Analysis/ScopedNoAliasAA.cpp
    llvm/trunk/lib/Analysis/TypeBasedAliasAnalysis.cpp
    llvm/trunk/lib/IR/Dominators.cpp
    llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp
    llvm/trunk/lib/Transforms/IPO/InferFunctionAttrs.cpp
    llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
    llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp
    llvm/trunk/lib/Transforms/Scalar/GVN.cpp
    llvm/trunk/lib/Transforms/Scalar/SROA.cpp
    llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp
    llvm/trunk/tools/opt/NewPMDriver.cpp
    llvm/trunk/unittests/Analysis/CGSCCPassManagerTest.cpp
    llvm/trunk/unittests/Analysis/LoopPassManagerTest.cpp
    llvm/trunk/unittests/IR/PassManagerTest.cpp

Modified: llvm/trunk/include/llvm/Analysis/AliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AliasAnalysis.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/AliasAnalysis.h Fri Mar 11 05:05:24 2016
@@ -866,10 +866,10 @@ public:
     ResultGetters.push_back(&getModuleAAResultImpl<AnalysisT>);
   }
 
-  Result run(Function &F, AnalysisManager<Function> *AM) {
-    Result R(AM->getResult<TargetLibraryAnalysis>(F));
+  Result run(Function &F, AnalysisManager<Function> &AM) {
+    Result R(AM.getResult<TargetLibraryAnalysis>(F));
     for (auto &Getter : ResultGetters)
-      (*Getter)(F, *AM, R);
+      (*Getter)(F, AM, R);
     return R;
   }
 

Modified: llvm/trunk/include/llvm/Analysis/AliasAnalysisEvaluator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AliasAnalysisEvaluator.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AliasAnalysisEvaluator.h (original)
+++ llvm/trunk/include/llvm/Analysis/AliasAnalysisEvaluator.h Fri Mar 11 05:05:24 2016
@@ -55,7 +55,7 @@ public:
   static StringRef name() { return "AAEvaluator"; }
 
   /// \brief Run the pass over the function.
-  PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+  PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
 
 private:
   // Allow the legacy pass to run this using an internal API.

Modified: llvm/trunk/include/llvm/Analysis/AssumptionCache.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AssumptionCache.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AssumptionCache.h (original)
+++ llvm/trunk/include/llvm/Analysis/AssumptionCache.h Fri Mar 11 05:05:24 2016
@@ -115,7 +115,7 @@ class AssumptionPrinterPass : public Pas
 
 public:
   explicit AssumptionPrinterPass(raw_ostream &OS) : OS(OS) {}
-  PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+  PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
 
   static StringRef name() { return "AssumptionPrinterPass"; }
 };

Modified: llvm/trunk/include/llvm/Analysis/BasicAliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/BasicAliasAnalysis.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/BasicAliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/BasicAliasAnalysis.h Fri Mar 11 05:05:24 2016
@@ -187,7 +187,7 @@ class BasicAA : public AnalysisInfoMixin
 public:
   typedef BasicAAResult Result;
 
-  BasicAAResult run(Function &F, AnalysisManager<Function> *AM);
+  BasicAAResult run(Function &F, AnalysisManager<Function> &AM);
 };
 
 /// Legacy wrapper pass to provide the BasicAAResult object.

Modified: llvm/trunk/include/llvm/Analysis/CFLAliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CFLAliasAnalysis.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CFLAliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/CFLAliasAnalysis.h Fri Mar 11 05:05:24 2016
@@ -116,7 +116,7 @@ class CFLAA : public AnalysisInfoMixin<C
 public:
   typedef CFLAAResult Result;
 
-  CFLAAResult run(Function &F, AnalysisManager<Function> *AM);
+  CFLAAResult run(Function &F, AnalysisManager<Function> &AM);
 };
 
 /// Legacy wrapper pass to provide the CFLAAResult object.

Modified: llvm/trunk/include/llvm/Analysis/CGSCCPassManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CGSCCPassManager.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CGSCCPassManager.h (original)
+++ llvm/trunk/include/llvm/Analysis/CGSCCPassManager.h Fri Mar 11 05:05:24 2016
@@ -88,20 +88,18 @@ public:
   }
 
   /// \brief Runs the CGSCC pass across every SCC in the module.
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager *AM) {
-    assert(AM && "We need analyses to compute the call graph!");
-
+  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM) {
     // Setup the CGSCC analysis manager from its proxy.
     CGSCCAnalysisManager &CGAM =
-        AM->getResult<CGSCCAnalysisManagerModuleProxy>(M).getManager();
+        AM.getResult<CGSCCAnalysisManagerModuleProxy>(M).getManager();
 
     // Get the call graph for this module.
-    LazyCallGraph &CG = AM->getResult<LazyCallGraphAnalysis>(M);
+    LazyCallGraph &CG = AM.getResult<LazyCallGraphAnalysis>(M);
 
     PreservedAnalyses PA = PreservedAnalyses::all();
     for (LazyCallGraph::RefSCC &OuterC : CG.postorder_ref_sccs())
       for (LazyCallGraph::SCC &C : OuterC) {
-        PreservedAnalyses PassPA = Pass.run(C, &CGAM);
+        PreservedAnalyses PassPA = Pass.run(C, CGAM);
 
         // We know that the CGSCC pass couldn't have invalidated any other
         // SCC's analyses (that's the contract of a CGSCC pass), so
@@ -180,11 +178,10 @@ public:
   }
 
   /// \brief Runs the function pass across every function in the module.
-  PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager *AM) {
-    FunctionAnalysisManager *FAM = nullptr;
-    if (AM)
-      // Setup the function analysis manager from its proxy.
-      FAM = &AM->getResult<FunctionAnalysisManagerCGSCCProxy>(C).getManager();
+  PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM) {
+    // Setup the function analysis manager from its proxy.
+    FunctionAnalysisManager &FAM =
+        AM.getResult<FunctionAnalysisManagerCGSCCProxy>(C).getManager();
 
     PreservedAnalyses PA = PreservedAnalyses::all();
     for (LazyCallGraph::Node &N : C) {
@@ -195,8 +192,7 @@ public:
       // directly handle the function analysis manager's invalidation here.
       // Also, update the preserved analyses to reflect that once invalidated
       // these can again be preserved.
-      if (FAM)
-        PassPA = FAM->invalidate(N.getFunction(), std::move(PassPA));
+      PassPA = FAM.invalidate(N.getFunction(), std::move(PassPA));
 
       // Then intersect the preserved set so that invalidation of module
       // analyses will eventually occur when the module pass completes.

Modified: llvm/trunk/include/llvm/Analysis/CallGraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CallGraph.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CallGraph.h (original)
+++ llvm/trunk/include/llvm/Analysis/CallGraph.h Fri Mar 11 05:05:24 2016
@@ -315,7 +315,7 @@ class CallGraphPrinterPass : public Pass
 
 public:
   explicit CallGraphPrinterPass(raw_ostream &OS) : OS(OS) {}
-  PreservedAnalyses run(Module &M, AnalysisManager<Module> *AM);
+  PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
 };
 
 /// \brief The \c ModulePass which wraps up a \c CallGraph and the logic to

Modified: llvm/trunk/include/llvm/Analysis/DominanceFrontier.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DominanceFrontier.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DominanceFrontier.h (original)
+++ llvm/trunk/include/llvm/Analysis/DominanceFrontier.h Fri Mar 11 05:05:24 2016
@@ -178,7 +178,7 @@ public:
   typedef DominanceFrontier Result;
 
   /// \brief Run the analysis pass over a function and produce a dominator tree.
-  DominanceFrontier run(Function &F, AnalysisManager<Function> *AM);
+  DominanceFrontier run(Function &F, AnalysisManager<Function> &AM);
 };
 
 /// \brief Printer pass for the \c DominanceFrontier.
@@ -188,7 +188,7 @@ class DominanceFrontierPrinterPass
 
 public:
   explicit DominanceFrontierPrinterPass(raw_ostream &OS);
-  PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+  PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
 };
 
 } // End llvm namespace

Modified: llvm/trunk/include/llvm/Analysis/GlobalsModRef.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/GlobalsModRef.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/GlobalsModRef.h (original)
+++ llvm/trunk/include/llvm/Analysis/GlobalsModRef.h Fri Mar 11 05:05:24 2016
@@ -125,7 +125,7 @@ class GlobalsAA : public AnalysisInfoMix
 public:
   typedef GlobalsAAResult Result;
 
-  GlobalsAAResult run(Module &M, AnalysisManager<Module> *AM);
+  GlobalsAAResult run(Module &M, AnalysisManager<Module> &AM);
 };
 
 /// Legacy wrapper pass to provide the GlobalsAAResult object.

Modified: llvm/trunk/include/llvm/Analysis/LazyCallGraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LazyCallGraph.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LazyCallGraph.h (original)
+++ llvm/trunk/include/llvm/Analysis/LazyCallGraph.h Fri Mar 11 05:05:24 2016
@@ -920,7 +920,7 @@ class LazyCallGraphPrinterPass
 public:
   explicit LazyCallGraphPrinterPass(raw_ostream &OS);
 
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager *AM);
+  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
 };
 
 }

Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Fri Mar 11 05:05:24 2016
@@ -794,7 +794,7 @@ class LoopAnalysis : public AnalysisInfo
 public:
   typedef LoopInfo Result;
 
-  LoopInfo run(Function &F, AnalysisManager<Function> *AM);
+  LoopInfo run(Function &F, AnalysisManager<Function> &AM);
 };
 
 /// \brief Printer pass for the \c LoopAnalysis results.
@@ -803,7 +803,7 @@ class LoopPrinterPass : public PassInfoM
 
 public:
   explicit LoopPrinterPass(raw_ostream &OS) : OS(OS) {}
-  PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+  PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
 };
 
 /// \brief The legacy pass manager's analysis pass to compute loop information.

Modified: llvm/trunk/include/llvm/Analysis/LoopPassManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopPassManager.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopPassManager.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopPassManager.h Fri Mar 11 05:05:24 2016
@@ -78,14 +78,12 @@ public:
   }
 
   /// \brief Runs the loop passes across every loop in the function.
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager *AM) {
-    assert(AM && "We need analyses to compute the loop structure!");
-
+  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM) {
     // Setup the loop analysis manager from its proxy.
-    LoopAnalysisManager *LAM =
-        &AM->getResult<LoopAnalysisManagerFunctionProxy>(F).getManager();
+    LoopAnalysisManager &LAM =
+        AM.getResult<LoopAnalysisManagerFunctionProxy>(F).getManager();
     // Get the loop structure for this function
-    LoopInfo &LI = AM->getResult<LoopAnalysis>(F);
+    LoopInfo &LI = AM.getResult<LoopAnalysis>(F);
 
     PreservedAnalyses PA = PreservedAnalyses::all();
 
@@ -109,7 +107,7 @@ public:
       // loop analysis manager's invalidation here.  Also, update the
       // preserved analyses to reflect that once invalidated these can again
       // be preserved.
-      PassPA = LAM->invalidate(*L, std::move(PassPA));
+      PassPA = LAM.invalidate(*L, std::move(PassPA));
 
       // Then intersect the preserved set so that invalidation of module
       // analyses will eventually occur when the module pass completes.

Modified: llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h Fri Mar 11 05:05:24 2016
@@ -479,7 +479,7 @@ class MemoryDependenceAnalysis
 public:
   typedef MemoryDependenceResults Result;
 
-  MemoryDependenceResults run(Function &F, AnalysisManager<Function> *AM);
+  MemoryDependenceResults run(Function &F, AnalysisManager<Function> &AM);
 };
 
 /// A wrapper analysis pass for the legacy pass manager that exposes a \c

Modified: llvm/trunk/include/llvm/Analysis/ObjCARCAliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ObjCARCAliasAnalysis.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ObjCARCAliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/ObjCARCAliasAnalysis.h Fri Mar 11 05:05:24 2016
@@ -68,7 +68,7 @@ class ObjCARCAA : public AnalysisInfoMix
 public:
   typedef ObjCARCAAResult Result;
 
-  ObjCARCAAResult run(Function &F, AnalysisManager<Function> *AM);
+  ObjCARCAAResult run(Function &F, AnalysisManager<Function> &AM);
 };
 
 /// Legacy wrapper pass to provide the ObjCARCAAResult object.

Modified: llvm/trunk/include/llvm/Analysis/PostDominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/PostDominators.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/PostDominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/PostDominators.h Fri Mar 11 05:05:24 2016
@@ -58,7 +58,7 @@ class PostDominatorTreePrinterPass
 
 public:
   explicit PostDominatorTreePrinterPass(raw_ostream &OS);
-  PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+  PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
 };
 
 struct PostDominatorTreeWrapperPass : public FunctionPass {

Modified: llvm/trunk/include/llvm/Analysis/RegionInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/RegionInfo.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/RegionInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/RegionInfo.h Fri Mar 11 05:05:24 2016
@@ -930,7 +930,7 @@ class RegionInfoAnalysis : public Analys
 public:
   typedef RegionInfo Result;
 
-  RegionInfo run(Function &F, AnalysisManager<Function> *AM);
+  RegionInfo run(Function &F, AnalysisManager<Function> &AM);
 };
 
 /// \brief Printer pass for the \c RegionInfo.
@@ -939,12 +939,12 @@ class RegionInfoPrinterPass : public Pas
 
 public:
   explicit RegionInfoPrinterPass(raw_ostream &OS);
-  PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+  PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
 };
 
 /// \brief Verifier pass for the \c RegionInfo.
 struct RegionInfoVerifierPass : PassInfoMixin<RegionInfoVerifierPass> {
-  PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+  PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
 };
 
 template <>

Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Fri Mar 11 05:05:24 2016
@@ -1438,7 +1438,7 @@ namespace llvm {
   public:
     typedef ScalarEvolution Result;
 
-    ScalarEvolution run(Function &F, AnalysisManager<Function> *AM);
+    ScalarEvolution run(Function &F, AnalysisManager<Function> &AM);
   };
 
   /// \brief Printer pass for the \c ScalarEvolutionAnalysis results.
@@ -1448,7 +1448,7 @@ namespace llvm {
 
   public:
     explicit ScalarEvolutionPrinterPass(raw_ostream &OS) : OS(OS) {}
-    PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+    PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
   };
 
   class ScalarEvolutionWrapperPass : public FunctionPass {

Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionAliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionAliasAnalysis.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolutionAliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionAliasAnalysis.h Fri Mar 11 05:05:24 2016
@@ -45,7 +45,7 @@ class SCEVAA : public AnalysisInfoMixin<
 public:
   typedef SCEVAAResult Result;
 
-  SCEVAAResult run(Function &F, AnalysisManager<Function> *AM);
+  SCEVAAResult run(Function &F, AnalysisManager<Function> &AM);
 };
 
 /// Legacy wrapper pass to provide the SCEVAAResult object.

Modified: llvm/trunk/include/llvm/Analysis/ScopedNoAliasAA.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScopedNoAliasAA.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScopedNoAliasAA.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScopedNoAliasAA.h Fri Mar 11 05:05:24 2016
@@ -54,7 +54,7 @@ class ScopedNoAliasAA : public AnalysisI
 public:
   typedef ScopedNoAliasAAResult Result;
 
-  ScopedNoAliasAAResult run(Function &F, AnalysisManager<Function> *AM);
+  ScopedNoAliasAAResult run(Function &F, AnalysisManager<Function> &AM);
 };
 
 /// Legacy wrapper pass to provide the ScopedNoAliasAAResult object.

Modified: llvm/trunk/include/llvm/Analysis/TypeBasedAliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/TypeBasedAliasAnalysis.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/TypeBasedAliasAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/TypeBasedAliasAnalysis.h Fri Mar 11 05:05:24 2016
@@ -55,7 +55,7 @@ class TypeBasedAA : public AnalysisInfoM
 public:
   typedef TypeBasedAAResult Result;
 
-  TypeBasedAAResult run(Function &F, AnalysisManager<Function> *AM);
+  TypeBasedAAResult run(Function &F, AnalysisManager<Function> &AM);
 };
 
 /// Legacy wrapper pass to provide the TypeBasedAAResult object.

Modified: llvm/trunk/include/llvm/IR/Dominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Dominators.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Dominators.h (original)
+++ llvm/trunk/include/llvm/IR/Dominators.h Fri Mar 11 05:05:24 2016
@@ -201,12 +201,12 @@ class DominatorTreePrinterPass
 
 public:
   explicit DominatorTreePrinterPass(raw_ostream &OS);
-  PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+  PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
 };
 
 /// \brief Verifier pass for the \c DominatorTree.
 struct DominatorTreeVerifierPass : PassInfoMixin<DominatorTreeVerifierPass> {
-  PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+  PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
 };
 
 /// \brief Legacy analysis pass which computes a \c DominatorTree.

Modified: llvm/trunk/include/llvm/IR/PassManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/PassManager.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/PassManager.h (original)
+++ llvm/trunk/include/llvm/IR/PassManager.h Fri Mar 11 05:05:24 2016
@@ -235,7 +235,7 @@ public:
   }
 
   /// \brief Run all of the passes in this manager over the IR.
-  PreservedAnalyses run(IRUnitT &IR, AnalysisManager<IRUnitT> *AM = nullptr) {
+  PreservedAnalyses run(IRUnitT &IR, AnalysisManager<IRUnitT> &AM) {
     PreservedAnalyses PA = PreservedAnalyses::all();
 
     if (DebugLogging)
@@ -248,13 +248,11 @@ public:
 
       PreservedAnalyses PassPA = Passes[Idx]->run(IR, AM);
 
-      // If we have an active analysis manager at this level we want to ensure
-      // we update it as each pass runs and potentially invalidates analyses.
-      // We also update the preserved set of analyses based on what analyses we
-      // have already handled the invalidation for here and don't need to
-      // invalidate when finished.
-      if (AM)
-        PassPA = AM->invalidate(IR, std::move(PassPA));
+      // Update the analysis manager as each pass runs and potentially
+      // invalidates analyses. We also update the preserved set of analyses
+      // based on what analyses we have already handled the invalidation for
+      // here and don't need to invalidate when finished.
+      PassPA = AM.invalidate(IR, std::move(PassPA));
 
       // Finally, we intersect the final preserved analyses to compute the
       // aggregate preserved set for this pass manager.
@@ -533,7 +531,7 @@ private:
       if (DebugLogging)
         dbgs() << "Running analysis: " << P.name() << "\n";
       AnalysisResultListT &ResultList = AnalysisResultLists[&IR];
-      ResultList.emplace_back(PassID, P.run(IR, this));
+      ResultList.emplace_back(PassID, P.run(IR, *this));
 
       // P.run may have inserted elements into AnalysisResults and invalidated
       // RI.
@@ -885,11 +883,10 @@ public:
   }
 
   /// \brief Runs the function pass across every function in the module.
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager *AM) {
-    FunctionAnalysisManager *FAM = nullptr;
-    if (AM)
-      // Setup the function analysis manager from its proxy.
-      FAM = &AM->getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
+  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM) {
+    // Setup the function analysis manager from its proxy.
+    FunctionAnalysisManager &FAM =
+        AM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
 
     PreservedAnalyses PA = PreservedAnalyses::all();
     for (Function &F : M) {
@@ -903,8 +900,7 @@ public:
       // directly handle the function analysis manager's invalidation here and
       // update our preserved set to reflect that these have already been
       // handled.
-      if (FAM)
-        PassPA = FAM->invalidate(F, std::move(PassPA));
+      PassPA = FAM.invalidate(F, std::move(PassPA));
 
       // Then intersect the preserved set so that invalidation of module
       // analyses will eventually occur when the module pass completes.
@@ -944,9 +940,8 @@ struct RequireAnalysisPass : PassInfoMix
   /// created, these methods can be instantiated to satisfy whatever the
   /// context requires.
   template <typename IRUnitT>
-  PreservedAnalyses run(IRUnitT &Arg, AnalysisManager<IRUnitT> *AM) {
-    if (AM)
-      (void)AM->template getResult<AnalysisT>(Arg);
+  PreservedAnalyses run(IRUnitT &Arg, AnalysisManager<IRUnitT> &AM) {
+    (void)AM.template getResult<AnalysisT>(Arg);
 
     return PreservedAnalyses::all();
   }
@@ -967,11 +962,10 @@ struct InvalidateAnalysisPass
   /// created, these methods can be instantiated to satisfy whatever the
   /// context requires.
   template <typename IRUnitT>
-  PreservedAnalyses run(IRUnitT &Arg, AnalysisManager<IRUnitT> *AM) {
-    if (AM)
-      // We have to directly invalidate the analysis result as we can't
-      // enumerate all other analyses and use the preserved set to control it.
-      (void)AM->template invalidate<AnalysisT>(Arg);
+  PreservedAnalyses run(IRUnitT &Arg, AnalysisManager<IRUnitT> &AM) {
+    // We have to directly invalidate the analysis result as we can't
+    // enumerate all other analyses and use the preserved set to control it.
+    AM.template invalidate<AnalysisT>(Arg);
 
     return PreservedAnalyses::all();
   }

Modified: llvm/trunk/include/llvm/IR/PassManagerInternal.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/PassManagerInternal.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/PassManagerInternal.h (original)
+++ llvm/trunk/include/llvm/IR/PassManagerInternal.h Fri Mar 11 05:05:24 2016
@@ -40,7 +40,7 @@ template <typename IRUnitT> struct PassC
   /// Note that actual pass object can omit the analysis manager argument if
   /// desired. Also that the analysis manager may be null if there is no
   /// analysis manager in the pass pipeline.
-  virtual PreservedAnalyses run(IRUnitT &IR, AnalysisManager<IRUnitT> *AM) = 0;
+  virtual PreservedAnalyses run(IRUnitT &IR, AnalysisManager<IRUnitT> &AM) = 0;
 
   /// \brief Polymorphic method to access the name of a pass.
   virtual StringRef name() = 0;
@@ -55,7 +55,7 @@ class PassRunAcceptsAnalysisManager {
     char a, b;
   };
 
-  template <typename T, ResultT (T::*)(IRUnitT &, AnalysisManager<IRUnitT> *)>
+  template <typename T, ResultT (T::*)(IRUnitT &, AnalysisManager<IRUnitT> &)>
   struct Checker;
 
   template <typename T> static SmallType f(Checker<T, &T::run> *);
@@ -96,7 +96,7 @@ struct PassModel<IRUnitT, PassT, Preserv
     return *this;
   }
 
-  PreservedAnalysesT run(IRUnitT &IR, AnalysisManager<IRUnitT> *AM) override {
+  PreservedAnalysesT run(IRUnitT &IR, AnalysisManager<IRUnitT> &AM) override {
     return Pass.run(IR, AM);
   }
   StringRef name() override { return PassT::name(); }
@@ -122,7 +122,7 @@ struct PassModel<IRUnitT, PassT, Preserv
     return *this;
   }
 
-  PreservedAnalysesT run(IRUnitT &IR, AnalysisManager<IRUnitT> *AM) override {
+  PreservedAnalysesT run(IRUnitT &IR, AnalysisManager<IRUnitT> &) override {
     return Pass.run(IR);
   }
   StringRef name() override { return PassT::name(); }
@@ -252,7 +252,7 @@ template <typename IRUnitT> struct Analy
   /// \returns A unique_ptr to the analysis result object to be queried by
   /// users.
   virtual std::unique_ptr<AnalysisResultConcept<IRUnitT>>
-  run(IRUnitT &IR, AnalysisManager<IRUnitT> *AM) = 0;
+  run(IRUnitT &IR, AnalysisManager<IRUnitT> &AM) = 0;
 
   /// \brief Polymorphic method to access the name of a pass.
   virtual StringRef name() = 0;
@@ -294,7 +294,7 @@ struct AnalysisPassModel<IRUnitT, PassT,
   ///
   /// The return is wrapped in an \c AnalysisResultModel.
   std::unique_ptr<AnalysisResultConcept<IRUnitT>>
-  run(IRUnitT &IR, AnalysisManager<IRUnitT> *AM) override {
+  run(IRUnitT &IR, AnalysisManager<IRUnitT> &AM) override {
     return make_unique<ResultModelT>(Pass.run(IR, AM));
   }
 
@@ -332,7 +332,7 @@ struct AnalysisPassModel<IRUnitT, PassT,
   ///
   /// The return is wrapped in an \c AnalysisResultModel.
   std::unique_ptr<AnalysisResultConcept<IRUnitT>>
-  run(IRUnitT &IR, AnalysisManager<IRUnitT> *) override {
+  run(IRUnitT &IR, AnalysisManager<IRUnitT> &) override {
     return make_unique<ResultModelT>(Pass.run(IR));
   }
 

Modified: llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h Fri Mar 11 05:05:24 2016
@@ -30,7 +30,7 @@ namespace llvm {
 /// attribute. It also discovers function arguments that are not captured by
 /// the function and marks them with the nocapture attribute.
 struct PostOrderFunctionAttrsPass : PassInfoMixin<PostOrderFunctionAttrsPass> {
-  PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager *AM);
+  PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM);
 };
 
 /// Create a legacy pass manager instance of a pass to compute function attrs

Modified: llvm/trunk/include/llvm/Transforms/IPO/InferFunctionAttrs.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/InferFunctionAttrs.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/InferFunctionAttrs.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/InferFunctionAttrs.h Fri Mar 11 05:05:24 2016
@@ -24,7 +24,7 @@ namespace llvm {
 /// A pass which infers function attributes from the names and signatures of
 /// function declarations in a module.
 struct InferFunctionAttrsPass : PassInfoMixin<InferFunctionAttrsPass> {
-  PreservedAnalyses run(Module &M, AnalysisManager<Module> *AM);
+  PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
 };
 
 /// Create a legacy pass manager instance of a pass to infer function

Modified: llvm/trunk/include/llvm/Transforms/InstCombine/InstCombine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/InstCombine/InstCombine.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/InstCombine/InstCombine.h (original)
+++ llvm/trunk/include/llvm/Transforms/InstCombine/InstCombine.h Fri Mar 11 05:05:24 2016
@@ -43,7 +43,7 @@ public:
     return *this;
   }
 
-  PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+  PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
 };
 
 /// \brief The legacy pass manager's instcombine pass.

Modified: llvm/trunk/include/llvm/Transforms/Scalar/EarlyCSE.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar/EarlyCSE.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar/EarlyCSE.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar/EarlyCSE.h Fri Mar 11 05:05:24 2016
@@ -28,7 +28,7 @@ namespace llvm {
 /// expected that a later pass of GVN will catch the interesting/hard cases.
 struct EarlyCSEPass : PassInfoMixin<EarlyCSEPass> {
   /// \brief Run the pass over the function.
-  PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+  PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
 };
 
 }

Modified: llvm/trunk/include/llvm/Transforms/Scalar/GVN.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar/GVN.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar/GVN.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar/GVN.h Fri Mar 11 05:05:24 2016
@@ -46,7 +46,7 @@ class GVN : public PassInfoMixin<GVN> {
 public:
 
   /// \brief Run the pass over the function.
-  PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+  PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
 
   /// This removes the specified instruction from
   /// our various maps and marks it for deletion.

Modified: llvm/trunk/include/llvm/Transforms/Scalar/SROA.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar/SROA.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar/SROA.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar/SROA.h Fri Mar 11 05:05:24 2016
@@ -102,7 +102,7 @@ public:
   SROA() : C(nullptr), DT(nullptr), AC(nullptr) {}
 
   /// \brief Run the pass over the function.
-  PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+  PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
 
 private:
   friend class sroa::AllocaSliceRewriter;

Modified: llvm/trunk/include/llvm/Transforms/Scalar/SimplifyCFG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar/SimplifyCFG.h?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar/SimplifyCFG.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar/SimplifyCFG.h Fri Mar 11 05:05:24 2016
@@ -36,7 +36,7 @@ public:
   SimplifyCFGPass(int BonusInstThreshold);
 
   /// \brief Run the pass over the function.
-  PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+  PreservedAnalyses run(Function &F, AnalysisManager<Function> &AM);
 };
 
 }

Modified: llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp Fri Mar 11 05:05:24 2016
@@ -88,8 +88,8 @@ static inline bool isInterestingPointer(
       && !isa<ConstantPointerNull>(V);
 }
 
-PreservedAnalyses AAEvaluator::run(Function &F, AnalysisManager<Function> *AM) {
-  runInternal(F, AM->getResult<AAManager>(F));
+PreservedAnalyses AAEvaluator::run(Function &F, AnalysisManager<Function> &AM) {
+  runInternal(F, AM.getResult<AAManager>(F));
   return PreservedAnalyses::all();
 }
 

Modified: llvm/trunk/lib/Analysis/AssumptionCache.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AssumptionCache.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AssumptionCache.cpp (original)
+++ llvm/trunk/lib/Analysis/AssumptionCache.cpp Fri Mar 11 05:05:24 2016
@@ -77,8 +77,8 @@ void AssumptionCache::registerAssumption
 char AssumptionAnalysis::PassID;
 
 PreservedAnalyses AssumptionPrinterPass::run(Function &F,
-                                             AnalysisManager<Function> *AM) {
-  AssumptionCache &AC = AM->getResult<AssumptionAnalysis>(F);
+                                             AnalysisManager<Function> &AM) {
+  AssumptionCache &AC = AM.getResult<AssumptionAnalysis>(F);
 
   OS << "Cached assumptions for function: " << F.getName() << "\n";
   for (auto &VH : AC.assumptions())

Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Fri Mar 11 05:05:24 2016
@@ -1608,12 +1608,12 @@ bool BasicAAResult::constantOffsetHeuris
 
 char BasicAA::PassID;
 
-BasicAAResult BasicAA::run(Function &F, AnalysisManager<Function> *AM) {
+BasicAAResult BasicAA::run(Function &F, AnalysisManager<Function> &AM) {
   return BasicAAResult(F.getParent()->getDataLayout(),
-                       AM->getResult<TargetLibraryAnalysis>(F),
-                       AM->getResult<AssumptionAnalysis>(F),
-                       AM->getCachedResult<DominatorTreeAnalysis>(F),
-                       AM->getCachedResult<LoopAnalysis>(F));
+                       AM.getResult<TargetLibraryAnalysis>(F),
+                       AM.getResult<AssumptionAnalysis>(F),
+                       AM.getCachedResult<DominatorTreeAnalysis>(F),
+                       AM.getCachedResult<LoopAnalysis>(F));
 }
 
 BasicAAWrapperPass::BasicAAWrapperPass() : FunctionPass(ID) {

Modified: llvm/trunk/lib/Analysis/CFLAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CFLAliasAnalysis.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CFLAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/CFLAliasAnalysis.cpp Fri Mar 11 05:05:24 2016
@@ -1090,7 +1090,7 @@ AliasResult CFLAAResult::query(const Mem
 
 char CFLAA::PassID;
 
-CFLAAResult CFLAA::run(Function &F, AnalysisManager<Function> *AM) {
+CFLAAResult CFLAA::run(Function &F, AnalysisManager<Function> &AM) {
   return CFLAAResult();
 }
 

Modified: llvm/trunk/lib/Analysis/CallGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CallGraph.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CallGraph.cpp (original)
+++ llvm/trunk/lib/Analysis/CallGraph.cpp Fri Mar 11 05:05:24 2016
@@ -263,8 +263,8 @@ void CallGraphNode::replaceCallEdge(Call
 char CallGraphAnalysis::PassID;
 
 PreservedAnalyses CallGraphPrinterPass::run(Module &M,
-                                            AnalysisManager<Module> *AM) {
-  AM->getResult<CallGraphAnalysis>(M).print(OS);
+                                            AnalysisManager<Module> &AM) {
+  AM.getResult<CallGraphAnalysis>(M).print(OS);
   return PreservedAnalyses::all();
 }
 

Modified: llvm/trunk/lib/Analysis/DominanceFrontier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DominanceFrontier.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/DominanceFrontier.cpp (original)
+++ llvm/trunk/lib/Analysis/DominanceFrontier.cpp Fri Mar 11 05:05:24 2016
@@ -59,9 +59,9 @@ LLVM_DUMP_METHOD void DominanceFrontierW
 char DominanceFrontierAnalysis::PassID;
 
 DominanceFrontier DominanceFrontierAnalysis::run(Function &F,
-                                                 FunctionAnalysisManager *AM) {
+                                                 FunctionAnalysisManager &AM) {
   DominanceFrontier DF;
-  DF.analyze(AM->getResult<DominatorTreeAnalysis>(F));
+  DF.analyze(AM.getResult<DominatorTreeAnalysis>(F));
   return DF;
 }
 
@@ -69,9 +69,9 @@ DominanceFrontierPrinterPass::DominanceF
   : OS(OS) {}
 
 PreservedAnalyses
-DominanceFrontierPrinterPass::run(Function &F, FunctionAnalysisManager *AM) {
+DominanceFrontierPrinterPass::run(Function &F, FunctionAnalysisManager &AM) {
   OS << "DominanceFrontier for function: " << F.getName() << "\n";
-  AM->getResult<DominanceFrontierAnalysis>(F).print(OS);
+  AM.getResult<DominanceFrontierAnalysis>(F).print(OS);
 
   return PreservedAnalyses::all();
 }

Modified: llvm/trunk/lib/Analysis/GlobalsModRef.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/GlobalsModRef.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/GlobalsModRef.cpp (original)
+++ llvm/trunk/lib/Analysis/GlobalsModRef.cpp Fri Mar 11 05:05:24 2016
@@ -938,10 +938,10 @@ GlobalsAAResult::analyzeModule(Module &M
 
 char GlobalsAA::PassID;
 
-GlobalsAAResult GlobalsAA::run(Module &M, AnalysisManager<Module> *AM) {
+GlobalsAAResult GlobalsAA::run(Module &M, AnalysisManager<Module> &AM) {
   return GlobalsAAResult::analyzeModule(M,
-                                        AM->getResult<TargetLibraryAnalysis>(M),
-                                        AM->getResult<CallGraphAnalysis>(M));
+                                        AM.getResult<TargetLibraryAnalysis>(M),
+                                        AM.getResult<CallGraphAnalysis>(M));
 }
 
 char GlobalsAAWrapperPass::ID = 0;

Modified: llvm/trunk/lib/Analysis/LazyCallGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LazyCallGraph.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LazyCallGraph.cpp (original)
+++ llvm/trunk/lib/Analysis/LazyCallGraph.cpp Fri Mar 11 05:05:24 2016
@@ -1531,8 +1531,8 @@ static void printRefSCC(raw_ostream &OS,
 }
 
 PreservedAnalyses LazyCallGraphPrinterPass::run(Module &M,
-                                                ModuleAnalysisManager *AM) {
-  LazyCallGraph &G = AM->getResult<LazyCallGraphAnalysis>(M);
+                                                ModuleAnalysisManager &AM) {
+  LazyCallGraph &G = AM.getResult<LazyCallGraphAnalysis>(M);
 
   OS << "Printing the call graph for module: " << M.getModuleIdentifier()
      << "\n\n";

Modified: llvm/trunk/lib/Analysis/LoopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopInfo.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopInfo.cpp Fri Mar 11 05:05:24 2016
@@ -643,7 +643,7 @@ void LoopInfo::markAsRemoved(Loop *Unloo
 
 char LoopAnalysis::PassID;
 
-LoopInfo LoopAnalysis::run(Function &F, AnalysisManager<Function> *AM) {
+LoopInfo LoopAnalysis::run(Function &F, AnalysisManager<Function> &AM) {
   // FIXME: Currently we create a LoopInfo from scratch for every function.
   // This may prove to be too wasteful due to deallocating and re-allocating
   // memory each time for the underlying map and vector datastructures. At some
@@ -651,13 +651,13 @@ LoopInfo LoopAnalysis::run(Function &F,
   // objects. I don't want to add that kind of complexity until the scope of
   // the problem is better understood.
   LoopInfo LI;
-  LI.analyze(AM->getResult<DominatorTreeAnalysis>(F));
+  LI.analyze(AM.getResult<DominatorTreeAnalysis>(F));
   return LI;
 }
 
 PreservedAnalyses LoopPrinterPass::run(Function &F,
-                                       AnalysisManager<Function> *AM) {
-  AM->getResult<LoopAnalysis>(F).print(OS);
+                                       AnalysisManager<Function> &AM) {
+  AM.getResult<LoopAnalysis>(F).print(OS);
   return PreservedAnalyses::all();
 }
 

Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Fri Mar 11 05:05:24 2016
@@ -1662,11 +1662,11 @@ void MemoryDependenceResults::verifyRemo
 char MemoryDependenceAnalysis::PassID;
 
 MemoryDependenceResults
-MemoryDependenceAnalysis::run(Function &F, AnalysisManager<Function> *AM) {
-  auto &AA = AM->getResult<AAManager>(F);
-  auto &AC = AM->getResult<AssumptionAnalysis>(F);
-  auto &TLI = AM->getResult<TargetLibraryAnalysis>(F);
-  auto *DT = AM->getCachedResult<DominatorTreeAnalysis>(F);
+MemoryDependenceAnalysis::run(Function &F, AnalysisManager<Function> &AM) {
+  auto &AA = AM.getResult<AAManager>(F);
+  auto &AC = AM.getResult<AssumptionAnalysis>(F);
+  auto &TLI = AM.getResult<TargetLibraryAnalysis>(F);
+  auto *DT = AM.getCachedResult<DominatorTreeAnalysis>(F);
   return MemoryDependenceResults(AA, AC, TLI, DT);
 }
 

Modified: llvm/trunk/lib/Analysis/ObjCARCAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ObjCARCAliasAnalysis.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ObjCARCAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/ObjCARCAliasAnalysis.cpp Fri Mar 11 05:05:24 2016
@@ -131,7 +131,7 @@ ModRefInfo ObjCARCAAResult::getModRefInf
   return AAResultBase::getModRefInfo(CS, Loc);
 }
 
-ObjCARCAAResult ObjCARCAA::run(Function &F, AnalysisManager<Function> *AM) {
+ObjCARCAAResult ObjCARCAA::run(Function &F, AnalysisManager<Function> &AM) {
   return ObjCARCAAResult(F.getParent()->getDataLayout());
 }
 

Modified: llvm/trunk/lib/Analysis/PostDominators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PostDominators.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/PostDominators.cpp (original)
+++ llvm/trunk/lib/Analysis/PostDominators.cpp Fri Mar 11 05:05:24 2016
@@ -56,9 +56,9 @@ PostDominatorTreePrinterPass::PostDomina
   : OS(OS) {}
 
 PreservedAnalyses
-PostDominatorTreePrinterPass::run(Function &F, FunctionAnalysisManager *AM) {
+PostDominatorTreePrinterPass::run(Function &F, FunctionAnalysisManager &AM) {
   OS << "PostDominatorTree for function: " << F.getName() << "\n";
-  AM->getResult<PostDominatorTreeAnalysis>(F).print(OS);
+  AM.getResult<PostDominatorTreeAnalysis>(F).print(OS);
 
   return PreservedAnalyses::all();
 }

Modified: llvm/trunk/lib/Analysis/RegionInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/RegionInfo.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/RegionInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/RegionInfo.cpp Fri Mar 11 05:05:24 2016
@@ -187,11 +187,11 @@ namespace llvm {
 
 char RegionInfoAnalysis::PassID;
 
-RegionInfo RegionInfoAnalysis::run(Function &F, AnalysisManager<Function> *AM) {
+RegionInfo RegionInfoAnalysis::run(Function &F, AnalysisManager<Function> &AM) {
   RegionInfo RI;
-  auto *DT = &AM->getResult<DominatorTreeAnalysis>(F);
-  auto *PDT = &AM->getResult<PostDominatorTreeAnalysis>(F);
-  auto *DF = &AM->getResult<DominanceFrontierAnalysis>(F);
+  auto *DT = &AM.getResult<DominatorTreeAnalysis>(F);
+  auto *PDT = &AM.getResult<PostDominatorTreeAnalysis>(F);
+  auto *DF = &AM.getResult<DominanceFrontierAnalysis>(F);
 
   RI.recalculate(F, DT, PDT, DF);
   return RI;
@@ -200,17 +200,17 @@ RegionInfo RegionInfoAnalysis::run(Funct
 RegionInfoPrinterPass::RegionInfoPrinterPass(raw_ostream &OS)
   : OS(OS) {}
 
-PreservedAnalyses
-RegionInfoPrinterPass::run(Function &F, FunctionAnalysisManager *AM) {
+PreservedAnalyses RegionInfoPrinterPass::run(Function &F,
+                                             FunctionAnalysisManager &AM) {
   OS << "Region Tree for function: " << F.getName() << "\n";
-  AM->getResult<RegionInfoAnalysis>(F).print(OS);
+  AM.getResult<RegionInfoAnalysis>(F).print(OS);
 
   return PreservedAnalyses::all();
 }
 
 PreservedAnalyses RegionInfoVerifierPass::run(Function &F,
-                                              AnalysisManager<Function> *AM) {
-  AM->getResult<RegionInfoAnalysis>(F).verifyAnalysis();
+                                              AnalysisManager<Function> &AM) {
+  AM.getResult<RegionInfoAnalysis>(F).verifyAnalysis();
 
   return PreservedAnalyses::all();
 }

Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Fri Mar 11 05:05:24 2016
@@ -9733,16 +9733,16 @@ void ScalarEvolution::verify() const {
 char ScalarEvolutionAnalysis::PassID;
 
 ScalarEvolution ScalarEvolutionAnalysis::run(Function &F,
-                                             AnalysisManager<Function> *AM) {
-  return ScalarEvolution(F, AM->getResult<TargetLibraryAnalysis>(F),
-                         AM->getResult<AssumptionAnalysis>(F),
-                         AM->getResult<DominatorTreeAnalysis>(F),
-                         AM->getResult<LoopAnalysis>(F));
+                                             AnalysisManager<Function> &AM) {
+  return ScalarEvolution(F, AM.getResult<TargetLibraryAnalysis>(F),
+                         AM.getResult<AssumptionAnalysis>(F),
+                         AM.getResult<DominatorTreeAnalysis>(F),
+                         AM.getResult<LoopAnalysis>(F));
 }
 
 PreservedAnalyses
-ScalarEvolutionPrinterPass::run(Function &F, AnalysisManager<Function> *AM) {
-  AM->getResult<ScalarEvolutionAnalysis>(F).print(OS);
+ScalarEvolutionPrinterPass::run(Function &F, AnalysisManager<Function> &AM) {
+  AM.getResult<ScalarEvolutionAnalysis>(F).print(OS);
   return PreservedAnalyses::all();
 }
 

Modified: llvm/trunk/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp Fri Mar 11 05:05:24 2016
@@ -112,8 +112,8 @@ Value *SCEVAAResult::GetBaseValue(const
 
 char SCEVAA::PassID;
 
-SCEVAAResult SCEVAA::run(Function &F, AnalysisManager<Function> *AM) {
-  return SCEVAAResult(AM->getResult<ScalarEvolutionAnalysis>(F));
+SCEVAAResult SCEVAA::run(Function &F, AnalysisManager<Function> &AM) {
+  return SCEVAAResult(AM.getResult<ScalarEvolutionAnalysis>(F));
 }
 
 char SCEVAAWrapperPass::ID = 0;

Modified: llvm/trunk/lib/Analysis/ScopedNoAliasAA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScopedNoAliasAA.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScopedNoAliasAA.cpp (original)
+++ llvm/trunk/lib/Analysis/ScopedNoAliasAA.cpp Fri Mar 11 05:05:24 2016
@@ -175,7 +175,7 @@ bool ScopedNoAliasAAResult::mayAliasInSc
 char ScopedNoAliasAA::PassID;
 
 ScopedNoAliasAAResult ScopedNoAliasAA::run(Function &F,
-                                           AnalysisManager<Function> *AM) {
+                                           AnalysisManager<Function> &AM) {
   return ScopedNoAliasAAResult();
 }
 

Modified: llvm/trunk/lib/Analysis/TypeBasedAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/TypeBasedAliasAnalysis.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/TypeBasedAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/TypeBasedAliasAnalysis.cpp Fri Mar 11 05:05:24 2016
@@ -585,7 +585,7 @@ bool TypeBasedAAResult::PathAliases(cons
 
 char TypeBasedAA::PassID;
 
-TypeBasedAAResult TypeBasedAA::run(Function &F, AnalysisManager<Function> *AM) {
+TypeBasedAAResult TypeBasedAA::run(Function &F, AnalysisManager<Function> &AM) {
   return TypeBasedAAResult();
 }
 

Modified: llvm/trunk/lib/IR/Dominators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Dominators.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Dominators.cpp (original)
+++ llvm/trunk/lib/IR/Dominators.cpp Fri Mar 11 05:05:24 2016
@@ -313,16 +313,16 @@ char DominatorTreeAnalysis::PassID;
 DominatorTreePrinterPass::DominatorTreePrinterPass(raw_ostream &OS) : OS(OS) {}
 
 PreservedAnalyses DominatorTreePrinterPass::run(Function &F,
-                                                FunctionAnalysisManager *AM) {
+                                                FunctionAnalysisManager &AM) {
   OS << "DominatorTree for function: " << F.getName() << "\n";
-  AM->getResult<DominatorTreeAnalysis>(F).print(OS);
+  AM.getResult<DominatorTreeAnalysis>(F).print(OS);
 
   return PreservedAnalyses::all();
 }
 
 PreservedAnalyses DominatorTreeVerifierPass::run(Function &F,
-                                                 FunctionAnalysisManager *AM) {
-  AM->getResult<DominatorTreeAnalysis>(F).verifyDomTree();
+                                                 FunctionAnalysisManager &AM) {
+  AM.getResult<DominatorTreeAnalysis>(F).verifyDomTree();
 
   return PreservedAnalyses::all();
 }

Modified: llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp Fri Mar 11 05:05:24 2016
@@ -987,13 +987,13 @@ static bool addNoRecurseAttrs(const SCCN
   return setDoesNotRecurse(*F);
 }
 
-PreservedAnalyses
-PostOrderFunctionAttrsPass::run(LazyCallGraph::SCC &C, CGSCCAnalysisManager *AM) {
+PreservedAnalyses PostOrderFunctionAttrsPass::run(LazyCallGraph::SCC &C,
+                                                  CGSCCAnalysisManager &AM) {
   Module &M = *C.begin()->getFunction().getParent();
   const ModuleAnalysisManager &MAM =
-      AM->getResult<ModuleAnalysisManagerCGSCCProxy>(C).getManager();
+      AM.getResult<ModuleAnalysisManagerCGSCCProxy>(C).getManager();
   FunctionAnalysisManager &FAM =
-      AM->getResult<FunctionAnalysisManagerCGSCCProxy>(C).getManager();
+      AM.getResult<FunctionAnalysisManagerCGSCCProxy>(C).getManager();
 
   // FIXME: Need some way to make it more reasonable to assume that this is
   // always cached.

Modified: llvm/trunk/lib/Transforms/IPO/InferFunctionAttrs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/InferFunctionAttrs.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/InferFunctionAttrs.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/InferFunctionAttrs.cpp Fri Mar 11 05:05:24 2016
@@ -945,8 +945,8 @@ static bool inferAllPrototypeAttributes(
 }
 
 PreservedAnalyses InferFunctionAttrsPass::run(Module &M,
-                                              AnalysisManager<Module> *AM) {
-  auto &TLI = AM->getResult<TargetLibraryAnalysis>(M);
+                                              AnalysisManager<Module> &AM) {
+  auto &TLI = AM.getResult<TargetLibraryAnalysis>(M);
 
   if (!inferAllPrototypeAttributes(M, TLI))
     // If we didn't infer anything, preserve all analyses.

Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Fri Mar 11 05:05:24 2016
@@ -3082,12 +3082,12 @@ combineInstructionsOverFunction(Function
 }
 
 PreservedAnalyses InstCombinePass::run(Function &F,
-                                       AnalysisManager<Function> *AM) {
-  auto &AC = AM->getResult<AssumptionAnalysis>(F);
-  auto &DT = AM->getResult<DominatorTreeAnalysis>(F);
-  auto &TLI = AM->getResult<TargetLibraryAnalysis>(F);
+                                       AnalysisManager<Function> &AM) {
+  auto &AC = AM.getResult<AssumptionAnalysis>(F);
+  auto &DT = AM.getResult<DominatorTreeAnalysis>(F);
+  auto &TLI = AM.getResult<TargetLibraryAnalysis>(F);
 
-  auto *LI = AM->getCachedResult<LoopAnalysis>(F);
+  auto *LI = AM.getCachedResult<LoopAnalysis>(F);
 
   // FIXME: The AliasAnalysis is not yet supported in the new pass manager
   if (!combineInstructionsOverFunction(F, Worklist, nullptr, AC, TLI, DT,

Modified: llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp Fri Mar 11 05:05:24 2016
@@ -818,11 +818,11 @@ bool EarlyCSE::run() {
 }
 
 PreservedAnalyses EarlyCSEPass::run(Function &F,
-                                    AnalysisManager<Function> *AM) {
-  auto &TLI = AM->getResult<TargetLibraryAnalysis>(F);
-  auto &TTI = AM->getResult<TargetIRAnalysis>(F);
-  auto &DT = AM->getResult<DominatorTreeAnalysis>(F);
-  auto &AC = AM->getResult<AssumptionAnalysis>(F);
+                                    AnalysisManager<Function> &AM) {
+  auto &TLI = AM.getResult<TargetLibraryAnalysis>(F);
+  auto &TTI = AM.getResult<TargetIRAnalysis>(F);
+  auto &DT = AM.getResult<DominatorTreeAnalysis>(F);
+  auto &AC = AM.getResult<AssumptionAnalysis>(F);
 
   EarlyCSE CSE(TLI, TTI, DT, AC);
 

Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Fri Mar 11 05:05:24 2016
@@ -584,12 +584,12 @@ void GVN::ValueTable::verifyRemoved(cons
 //                                GVN Pass
 //===----------------------------------------------------------------------===//
 
-PreservedAnalyses GVN::run(Function &F, AnalysisManager<Function> *AM) {
-  bool Changed = runImpl(F, AM->getResult<AssumptionAnalysis>(F),
-                         AM->getResult<DominatorTreeAnalysis>(F),
-                         AM->getResult<TargetLibraryAnalysis>(F),
-                         AM->getResult<AAManager>(F),
-                         &AM->getResult<MemoryDependenceAnalysis>(F));
+PreservedAnalyses GVN::run(Function &F, AnalysisManager<Function> &AM) {
+  bool Changed = runImpl(F, AM.getResult<AssumptionAnalysis>(F),
+                         AM.getResult<DominatorTreeAnalysis>(F),
+                         AM.getResult<TargetLibraryAnalysis>(F),
+                         AM.getResult<AAManager>(F),
+                         &AM.getResult<MemoryDependenceAnalysis>(F));
   return Changed ? PreservedAnalyses::none() : PreservedAnalyses::all();
 }
 

Modified: llvm/trunk/lib/Transforms/Scalar/SROA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SROA.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SROA.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SROA.cpp Fri Mar 11 05:05:24 2016
@@ -4241,9 +4241,9 @@ PreservedAnalyses SROA::runImpl(Function
   return Changed ? PreservedAnalyses::none() : PreservedAnalyses::all();
 }
 
-PreservedAnalyses SROA::run(Function &F, AnalysisManager<Function> *AM) {
-  return runImpl(F, AM->getResult<DominatorTreeAnalysis>(F),
-                 AM->getResult<AssumptionAnalysis>(F));
+PreservedAnalyses SROA::run(Function &F, AnalysisManager<Function> &AM) {
+  return runImpl(F, AM.getResult<DominatorTreeAnalysis>(F),
+                 AM.getResult<AssumptionAnalysis>(F));
 }
 
 /// A legacy pass for the legacy pass manager that wraps the \c SROA pass.

Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp Fri Mar 11 05:05:24 2016
@@ -178,9 +178,9 @@ SimplifyCFGPass::SimplifyCFGPass(int Bon
     : BonusInstThreshold(BonusInstThreshold) {}
 
 PreservedAnalyses SimplifyCFGPass::run(Function &F,
-                                       AnalysisManager<Function> *AM) {
-  auto &TTI = AM->getResult<TargetIRAnalysis>(F);
-  auto &AC = AM->getResult<AssumptionAnalysis>(F);
+                                       AnalysisManager<Function> &AM) {
+  auto &TTI = AM.getResult<TargetIRAnalysis>(F);
+  auto &AC = AM.getResult<AssumptionAnalysis>(F);
 
   if (simplifyFunctionCFG(F, TTI, &AC, BonusInstThreshold))
     return PreservedAnalyses::none();

Modified: llvm/trunk/tools/opt/NewPMDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/NewPMDriver.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/tools/opt/NewPMDriver.cpp (original)
+++ llvm/trunk/tools/opt/NewPMDriver.cpp Fri Mar 11 05:05:24 2016
@@ -118,7 +118,7 @@ bool llvm::runPassPipeline(StringRef Arg
   cl::PrintOptionValues();
 
   // Now that we have all of the passes ready, run them.
-  MPM.run(M, &MAM);
+  MPM.run(M, MAM);
 
   // Declare success.
   if (OK != OK_NoOutput)

Modified: llvm/trunk/unittests/Analysis/CGSCCPassManagerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/CGSCCPassManagerTest.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/unittests/Analysis/CGSCCPassManagerTest.cpp (original)
+++ llvm/trunk/unittests/Analysis/CGSCCPassManagerTest.cpp Fri Mar 11 05:05:24 2016
@@ -34,7 +34,7 @@ public:
 
   TestModuleAnalysis(int &Runs) : Runs(Runs) {}
 
-  Result run(Module &M, ModuleAnalysisManager *AM) {
+  Result run(Module &M, ModuleAnalysisManager &AM) {
     ++Runs;
     return Result(M.size());
   }
@@ -59,7 +59,7 @@ public:
 
   TestSCCAnalysis(int &Runs) : Runs(Runs) {}
 
-  Result run(LazyCallGraph::SCC &C, CGSCCAnalysisManager *AM) {
+  Result run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM) {
     ++Runs;
     return Result(C.size());
   }
@@ -84,7 +84,7 @@ public:
 
   TestFunctionAnalysis(int &Runs) : Runs(Runs) {}
 
-  Result run(Function &F, FunctionAnalysisManager *AM) {
+  Result run(Function &F, FunctionAnalysisManager &AM) {
     ++Runs;
     int Count = 0;
     for (Instruction &I : instructions(F)) {
@@ -113,7 +113,7 @@ public:
 
   TestImmutableFunctionAnalysis(int &Runs) : Runs(Runs) {}
 
-  Result run(Function &F, FunctionAnalysisManager *AM) {
+  Result run(Function &F, FunctionAnalysisManager &AM) {
     ++Runs;
     return Result();
   }
@@ -129,9 +129,9 @@ char TestImmutableFunctionAnalysis::Pass
 struct TestModulePass {
   TestModulePass(int &RunCount) : RunCount(RunCount) {}
 
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager *AM) {
+  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM) {
     ++RunCount;
-    (void)AM->getResult<TestModuleAnalysis>(M);
+    (void)AM.getResult<TestModuleAnalysis>(M);
     return PreservedAnalyses::all();
   }
 
@@ -150,13 +150,13 @@ struct TestSCCPass {
         AnalyzedModuleFunctionCount(AnalyzedModuleFunctionCount),
         OnlyUseCachedResults(OnlyUseCachedResults) {}
 
-  PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager *AM) {
+  PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM) {
     ++RunCount;
 
     const ModuleAnalysisManager &MAM =
-        AM->getResult<ModuleAnalysisManagerCGSCCProxy>(C).getManager();
+        AM.getResult<ModuleAnalysisManagerCGSCCProxy>(C).getManager();
     FunctionAnalysisManager &FAM =
-        AM->getResult<FunctionAnalysisManagerCGSCCProxy>(C).getManager();
+        AM.getResult<FunctionAnalysisManagerCGSCCProxy>(C).getManager();
     if (TestModuleAnalysis::Result *TMA =
             MAM.getCachedResult<TestModuleAnalysis>(
                 *C.begin()->getFunction().getParent()))
@@ -164,8 +164,7 @@ struct TestSCCPass {
 
     if (OnlyUseCachedResults) {
       // Hack to force the use of the cached interface.
-      if (TestSCCAnalysis::Result *AR =
-              AM->getCachedResult<TestSCCAnalysis>(C))
+      if (TestSCCAnalysis::Result *AR = AM.getCachedResult<TestSCCAnalysis>(C))
         AnalyzedSCCFunctionCount += AR->FunctionCount;
       for (LazyCallGraph::Node &N : C)
         if (TestFunctionAnalysis::Result *FAR =
@@ -173,7 +172,7 @@ struct TestSCCPass {
           AnalyzedInstrCount += FAR->InstructionCount;
     } else {
       // Typical path just runs the analysis as needed.
-      TestSCCAnalysis::Result &AR = AM->getResult<TestSCCAnalysis>(C);
+      TestSCCAnalysis::Result &AR = AM.getResult<TestSCCAnalysis>(C);
       AnalyzedSCCFunctionCount += AR.FunctionCount;
       for (LazyCallGraph::Node &N : C) {
         TestFunctionAnalysis::Result &FAR =
@@ -301,7 +300,7 @@ TEST_F(CGSCCPassManagerTest, Basic) {
   CGPM1.addPass(createCGSCCToFunctionPassAdaptor(std::move(FPM1)));
   MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM1)));
 
-  MPM.run(*M, &MAM);
+  MPM.run(*M, MAM);
 
   EXPECT_EQ(1, ModulePassRunCount1);
 

Modified: llvm/trunk/unittests/Analysis/LoopPassManagerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/LoopPassManagerTest.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/unittests/Analysis/LoopPassManagerTest.cpp (original)
+++ llvm/trunk/unittests/Analysis/LoopPassManagerTest.cpp Fri Mar 11 05:05:24 2016
@@ -42,7 +42,7 @@ public:
   TestLoopAnalysis(int &Runs) : Runs(Runs) {}
 
   /// \brief Run the analysis pass over the loop and return a result.
-  Result run(Loop &L, AnalysisManager<Loop> *AM) {
+  Result run(Loop &L, AnalysisManager<Loop> &AM) {
     ++Runs;
     int Count = 0;
 
@@ -65,16 +65,16 @@ public:
       : VisitedLoops(VisitedLoops), AnalyzedBlockCount(AnalyzedBlockCount),
         OnlyUseCachedResults(OnlyUseCachedResults) {}
 
-  PreservedAnalyses run(Loop &L, AnalysisManager<Loop> *AM) {
+  PreservedAnalyses run(Loop &L, AnalysisManager<Loop> &AM) {
     VisitedLoops.push_back(L.getName());
 
     if (OnlyUseCachedResults) {
       // Hack to force the use of the cached interface.
-      if (auto *AR = AM->getCachedResult<TestLoopAnalysis>(L))
+      if (auto *AR = AM.getCachedResult<TestLoopAnalysis>(L))
         AnalyzedBlockCount += AR->BlockCount;
     } else {
       // Typical path just runs the analysis as needed.
-      auto &AR = AM->getResult<TestLoopAnalysis>(L);
+      auto &AR = AM.getResult<TestLoopAnalysis>(L);
       AnalyzedBlockCount += AR.BlockCount;
     }
 
@@ -91,7 +91,7 @@ class TestLoopInvalidatingPass {
 public:
   TestLoopInvalidatingPass(StringRef LoopName) : Name(LoopName) {}
 
-  PreservedAnalyses run(Loop &L, AnalysisManager<Loop> *AM) {
+  PreservedAnalyses run(Loop &L, AnalysisManager<Loop> &AM) {
     return L.getName() == Name ? PreservedAnalyses::none()
                                : PreservedAnalyses::all();
   }
@@ -185,7 +185,7 @@ TEST_F(LoopPassManagerTest, Basic) {
   }
 
   MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
-  MPM.run(*M, &MAM);
+  MPM.run(*M, MAM);
 
   StringRef ExpectedLoops[] = {"loop.0.0", "loop.0.1", "loop.0", "loop.g.0"};
 

Modified: llvm/trunk/unittests/IR/PassManagerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/PassManagerTest.cpp?rev=263219&r1=263218&r2=263219&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/PassManagerTest.cpp (original)
+++ llvm/trunk/unittests/IR/PassManagerTest.cpp Fri Mar 11 05:05:24 2016
@@ -29,7 +29,7 @@ public:
   TestFunctionAnalysis(int &Runs) : Runs(Runs) {}
 
   /// \brief Run the analysis pass over the function and return a result.
-  Result run(Function &F, FunctionAnalysisManager *AM) {
+  Result run(Function &F, FunctionAnalysisManager &AM) {
     ++Runs;
     int Count = 0;
     for (Function::iterator BBI = F.begin(), BBE = F.end(); BBI != BBE; ++BBI)
@@ -57,7 +57,7 @@ public:
 
   TestModuleAnalysis(int &Runs) : Runs(Runs) {}
 
-  Result run(Module &M, ModuleAnalysisManager *AM) {
+  Result run(Module &M, ModuleAnalysisManager &AM) {
     ++Runs;
     int Count = 0;
     for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
@@ -91,11 +91,11 @@ struct TestPreservingModulePass : PassIn
 
 struct TestMinPreservingModulePass
     : PassInfoMixin<TestMinPreservingModulePass> {
-  PreservedAnalyses run(Module &M, ModuleAnalysisManager *AM) {
+  PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM) {
     PreservedAnalyses PA;
 
     // Force running an analysis.
-    (void)AM->getResult<TestModuleAnalysis>(M);
+    (void)AM.getResult<TestModuleAnalysis>(M);
 
     PA.preserve<FunctionAnalysisManagerModuleProxy>();
     return PA;
@@ -110,11 +110,11 @@ struct TestFunctionPass : PassInfoMixin<
         AnalyzedFunctionCount(AnalyzedFunctionCount),
         OnlyUseCachedResults(OnlyUseCachedResults) {}
 
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager *AM) {
+  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM) {
     ++RunCount;
 
     const ModuleAnalysisManager &MAM =
-        AM->getResult<ModuleAnalysisManagerFunctionProxy>(F).getManager();
+        AM.getResult<ModuleAnalysisManagerFunctionProxy>(F).getManager();
     if (TestModuleAnalysis::Result *TMA =
             MAM.getCachedResult<TestModuleAnalysis>(*F.getParent()))
       AnalyzedFunctionCount += TMA->FunctionCount;
@@ -122,11 +122,11 @@ struct TestFunctionPass : PassInfoMixin<
     if (OnlyUseCachedResults) {
       // Hack to force the use of the cached interface.
       if (TestFunctionAnalysis::Result *AR =
-              AM->getCachedResult<TestFunctionAnalysis>(F))
+              AM.getCachedResult<TestFunctionAnalysis>(F))
         AnalyzedInstrCount += AR->InstructionCount;
     } else {
       // Typical path just runs the analysis as needed.
-      TestFunctionAnalysis::Result &AR = AM->getResult<TestFunctionAnalysis>(F);
+      TestFunctionAnalysis::Result &AR = AM.getResult<TestFunctionAnalysis>(F);
       AnalyzedInstrCount += AR.InstructionCount;
     }
 
@@ -298,7 +298,7 @@ TEST_F(PassManagerTest, Basic) {
     MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
   }
 
-  MPM.run(*M, &MAM);
+  MPM.run(*M, MAM);
 
   // Validate module pass counters.
   EXPECT_EQ(1, ModulePassRunCount);




More information about the llvm-commits mailing list