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.
/// \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.
///
/// 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.
PrintLoopPass();
PrintLoopPass(raw_ostream &OS, const std::string &Banner = "");
- PreservedAnalyses run(Loop &L);
+ PreservedAnalyses run(Loop &L, AnalysisManager<Loop> &);
};
} // End llvm namespace
/// \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.
return *this;
}
- Result run(Module &M);
+ Result run(Module &M, ModuleAnalysisManager &);
private:
friend AnalysisInfoMixin<ProfileSummaryAnalysis>;
return *this;
}
- TargetLibraryInfo run(Module &M);
- TargetLibraryInfo run(Function &F);
+ TargetLibraryInfo run(Module &M, ModuleAnalysisManager &);
+ TargetLibraryInfo run(Function &F, FunctionAnalysisManager &);
private:
friend AnalysisInfoMixin<TargetLibraryAnalysis>;
return *this;
}
- Result run(const Function &F);
+ Result run(const Function &F, AnalysisManager<Function> &);
private:
friend AnalysisInfoMixin<TargetIRAnalysis>;
#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
/// \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"; }
};
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.
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.
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"; }
};
PrintFunctionPass();
PrintFunctionPass(raw_ostream &OS, const std::string &Banner = "");
- PreservedAnalyses run(Function &F);
+ PreservedAnalyses run(Function &F, AnalysisManager<Function> &);
static StringRef name() { return "PrintFunctionPass"; }
};
/// 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<
/// \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<
/// 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();
}
};
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.
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
/// \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.
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(); }
-
- PassT Pass;
-};
-
} // End namespace detail
}
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.
/// 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 &);
};
}
public:
DeadArgumentEliminationPass(bool ShouldHackArguments_ = false)
: ShouldHackArguments(ShouldHackArguments_) {}
- PreservedAnalyses run(Module &M);
+ PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
private:
Liveness MarkIfNotLive(RetOrArg Use, UseVector &MaybeLiveUses);
class EliminateAvailableExternallyPass
: public PassInfoMixin<EliminateAvailableExternallyPass> {
public:
- PreservedAnalyses run(Module &M);
+ PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
};
}
/// 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.
/// 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;
/// Pass to remove unused function declarations.
struct StripDeadPrototypesPass : PassInfoMixin<StripDeadPrototypesPass> {
- PreservedAnalyses run(Module &M);
+ PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
};
}
} // end namespace wholeprogramdevirt
struct WholeProgramDevirtPass : public PassInfoMixin<WholeProgramDevirtPass> {
- PreservedAnalyses run(Module &M);
+ PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
};
} // end 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 &);
};
}
/// 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 &);
};
}
/// 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 &);
};
}
bool MadeChange;
public:
- PreservedAnalyses run(Function &F);
+ PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
private:
void BuildRankMap(Function &F, ReversePostOrderTraversal<Function *> &RPOT);
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)
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;
}
};
char PostDominatorTreeAnalysis::PassID;
-PostDominatorTree PostDominatorTreeAnalysis::run(Function &F) {
+PostDominatorTree PostDominatorTreeAnalysis::run(Function &F,
+ FunctionAnalysisManager &) {
PostDominatorTree PDT;
PDT.recalculate(F);
return PDT;
}
char ProfileSummaryAnalysis::PassID;
-ProfileSummaryInfo ProfileSummaryAnalysis::run(Module &M) {
+ProfileSummaryInfo ProfileSummaryAnalysis::run(Module &M,
+ ModuleAnalysisManager &) {
return ProfileSummaryInfo(M);
}
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);
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);
}
}
TargetTransformInfo &TargetTransformInfoWrapperPass::getTTI(const Function &F) {
- TTI = TIRA.run(F);
+ AnalysisManager<Function> DummyFAM;
+ TTI = TIRA.run(F, DummyFAM);
return *TTI;
}
#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();
//
//===----------------------------------------------------------------------===//
-DominatorTree DominatorTreeAnalysis::run(Function &F) {
+DominatorTree DominatorTreeAnalysis::run(Function &F,
+ AnalysisManager<Function> &) {
DominatorTree DT;
DT.recalculate(F);
return DT;
: 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);
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();
: ModulePass(ID), P(OS, Banner, ShouldPreserveUseListOrder) {}
bool runOnModule(Module &M) override {
- P.run(M);
+ ModuleAnalysisManager DummyMAM;
+ P.run(M, DummyMAM);
return false;
}
// 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;
}
}
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 };
}
/// \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"; }
};
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"; }
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"; }
};
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"; }
};
public:
struct Result {};
- Result run(Loop &) { return Result(); }
+ Result run(Loop &, AnalysisManager<Loop> &) { return Result(); }
static StringRef name() { return "NoOpLoopAnalysis"; }
};
}
}
-PreservedAnalyses ConstantMergePass::run(Module &M) {
+PreservedAnalyses ConstantMergePass::run(Module &M, ModuleAnalysisManager &) {
if (!mergeConstants(M))
return PreservedAnalyses::all();
return PreservedAnalyses::none();
if (skipModule(M))
return false;
DeadArgumentEliminationPass DAEP(ShouldHackArguments());
- PreservedAnalyses PA = DAEP.run(M);
+ ModuleAnalysisManager DummyMAM;
+ PreservedAnalyses PA = DAEP.run(M, DummyMAM);
return !PA.areAllPreserved();
}
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 "..."
return Changed;
}
-PreservedAnalyses EliminateAvailableExternallyPass::run(Module &M) {
+PreservedAnalyses
+EliminateAvailableExternallyPass::run(Module &M, ModuleAnalysisManager &) {
if (!eliminateAvailableExternally(M))
return PreservedAnalyses::all();
return PreservedAnalyses::none();
}
}
-PreservedAnalyses ForceFunctionAttrsPass::run(Module &M) {
+PreservedAnalyses ForceFunctionAttrsPass::run(Module &M,
+ ModuleAnalysisManager &) {
if (ForceAttributes.empty())
return PreservedAnalyses::all();
if (skipModule(M))
return false;
- auto PA = Impl.run(M);
+ ModuleAnalysisManager DummyMAM;
+ auto PA = Impl.run(M, DummyMAM);
return !PA.areAllPreserved();
}
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.
return MadeChange;
}
-PreservedAnalyses StripDeadPrototypesPass::run(Module &M) {
+PreservedAnalyses StripDeadPrototypesPass::run(Module &M,
+ ModuleAnalysisManager &) {
if (stripDeadPrototypes(M))
return PreservedAnalyses::none();
return PreservedAnalyses::all();
return new WholeProgramDevirt;
}
-PreservedAnalyses WholeProgramDevirtPass::run(Module &M) {
+PreservedAnalyses WholeProgramDevirtPass::run(Module &M,
+ ModuleAnalysisManager &) {
if (!DevirtModule(M).run())
return PreservedAnalyses::all();
return PreservedAnalyses::none();
return !Worklist.empty();
}
-PreservedAnalyses ADCEPass::run(Function &F) {
+PreservedAnalyses ADCEPass::run(Function &F, FunctionAnalysisManager &) {
if (!aggressiveDCE(F))
return PreservedAnalyses::all();
return Changed;
}
-PreservedAnalyses LowerAtomicPass::run(Function &F) {
+PreservedAnalyses LowerAtomicPass::run(Function &F, FunctionAnalysisManager &) {
if (lowerAtomics(F))
return PreservedAnalyses::none();
return PreservedAnalyses::all();
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();
}
return Changed;
}
-PreservedAnalyses LowerExpectIntrinsicPass::run(Function &F) {
+PreservedAnalyses LowerExpectIntrinsicPass::run(Function &F,
+ FunctionAnalysisManager &) {
if (lowerExpectIntrinsic(F))
return PreservedAnalyses::none();
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
if (skipFunction(F))
return false;
- auto PA = Impl.run(F);
+ FunctionAnalysisManager DummyFAM;
+ auto PA = Impl.run(F, DummyFAM);
return !PA.areAllPreserved();
}
struct TestFunctionPass {
TestFunctionPass(int &RunCount) : RunCount(RunCount) {}
- PreservedAnalyses run(Function &M) {
+ PreservedAnalyses run(Function &F, AnalysisManager<Function> &) {
++RunCount;
return PreservedAnalyses::none();
}
struct TestModulePass : PassInfoMixin<TestModulePass> {
TestModulePass(int &RunCount) : RunCount(RunCount) {}
- PreservedAnalyses run(Module &M) {
+ PreservedAnalyses run(Module &M, ModuleAnalysisManager &) {
++RunCount;
return PreservedAnalyses::none();
}
};
struct TestPreservingModulePass : PassInfoMixin<TestPreservingModulePass> {
- PreservedAnalyses run(Module &M) { return PreservedAnalyses::all(); }
+ PreservedAnalyses run(Module &M, ModuleAnalysisManager &) {
+ return PreservedAnalyses::all();
+ }
};
struct TestMinPreservingModulePass
: 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();
}