[llvm] eb3d21b - [Passes] Remove some legacy printer passes
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 13 13:19:06 PDT 2023
Author: Arthur Eubanks
Date: 2023-06-13T13:18:48-07:00
New Revision: eb3d21be37c0b51d8e105a8c563626dd2b7e547d
URL: https://github.com/llvm/llvm-project/commit/eb3d21be37c0b51d8e105a8c563626dd2b7e547d
DIFF: https://github.com/llvm/llvm-project/commit/eb3d21be37c0b51d8e105a8c563626dd2b7e547d.diff
LOG: [Passes] Remove some legacy printer passes
MemDepPrinter doesn't have a new PM equivalent, but MemDep is soft deprecated anyway and adding one should be easy if somebody wants to.
Added:
Modified:
llvm/include/llvm/Analysis/MemorySSA.h
llvm/include/llvm/Analysis/Passes.h
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/LinkAllPasses.h
llvm/lib/Analysis/Analysis.cpp
llvm/lib/Analysis/CMakeLists.txt
llvm/lib/Analysis/MemDerefPrinter.cpp
llvm/lib/Analysis/MemorySSA.cpp
llvm/lib/Analysis/ModuleDebugInfoPrinter.cpp
llvm/lib/Analysis/MustExecute.cpp
llvm/utils/gn/secondary/llvm/lib/Analysis/BUILD.gn
Removed:
llvm/lib/Analysis/MemDepPrinter.cpp
################################################################################
diff --git a/llvm/include/llvm/Analysis/MemorySSA.h b/llvm/include/llvm/Analysis/MemorySSA.h
index 7038b663c3ab0..d71b2ac6c487f 100644
--- a/llvm/include/llvm/Analysis/MemorySSA.h
+++ b/llvm/include/llvm/Analysis/MemorySSA.h
@@ -798,7 +798,6 @@ class MemorySSA {
protected:
// Used by Memory SSA dumpers and wrapper pass
- friend class MemorySSAPrinterLegacyPass;
friend class MemorySSAUpdater;
void verifyOrderingDominationAndDefUses(
@@ -919,18 +918,6 @@ class MemorySSAUtil {
AliasAnalysis &AA);
};
-// This pass does eager building and then printing of MemorySSA. It is used by
-// the tests to be able to build, dump, and verify Memory SSA.
-class MemorySSAPrinterLegacyPass : public FunctionPass {
-public:
- MemorySSAPrinterLegacyPass();
-
- bool runOnFunction(Function &) override;
- void getAnalysisUsage(AnalysisUsage &AU) const override;
-
- static char ID;
-};
-
/// An analysis that produces \c MemorySSA for a function.
///
class MemorySSAAnalysis : public AnalysisInfoMixin<MemorySSAAnalysis> {
diff --git a/llvm/include/llvm/Analysis/Passes.h b/llvm/include/llvm/Analysis/Passes.h
index 4b4d8a71ef3f5..ac1bc3549910c 100644
--- a/llvm/include/llvm/Analysis/Passes.h
+++ b/llvm/include/llvm/Analysis/Passes.h
@@ -58,39 +58,6 @@ namespace llvm {
// in a function and builds the region hierarchy.
//
FunctionPass *createRegionInfoPass();
-
- // Print module-level debug info metadata in human-readable form.
- ModulePass *createModuleDebugInfoPrinterPass();
-
- //===--------------------------------------------------------------------===//
- //
- // createMemDepPrinter - This pass exhaustively collects all memdep
- // information and prints it with -analyze.
- //
- FunctionPass *createMemDepPrinter();
-
- //===--------------------------------------------------------------------===//
- //
- // createMemDerefPrinter - This pass collects memory dereferenceability
- // information and prints it with -analyze.
- //
- FunctionPass *createMemDerefPrinter();
-
- //===--------------------------------------------------------------------===//
- //
- // createMustExecutePrinter - This pass collects information about which
- // instructions within a loop are guaranteed to execute if the loop header is
- // entered and prints it with -analyze.
- //
- FunctionPass *createMustExecutePrinter();
-
- //===--------------------------------------------------------------------===//
- //
- // createMustBeExecutedContextPrinter - This pass prints information about which
- // instructions are guaranteed to execute together (run with -analyze).
- //
- ModulePass *createMustBeExecutedContextPrinter();
-
}
#endif
diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h
index 74a83254f4720..070688178d69e 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -237,18 +237,12 @@ void initializeMachineTraceMetricsPass(PassRegistry&);
void initializeMachineUniformityInfoPrinterPassPass(PassRegistry &);
void initializeMachineUniformityAnalysisPassPass(PassRegistry &);
void initializeMachineVerifierPassPass(PassRegistry&);
-void initializeMemDepPrinterPass(PassRegistry&);
-void initializeMemDerefPrinterPass(PassRegistry&);
void initializeMemoryDependenceWrapperPassPass(PassRegistry&);
-void initializeMemorySSAPrinterLegacyPassPass(PassRegistry&);
void initializeMemorySSAWrapperPassPass(PassRegistry&);
void initializeMergeICmpsLegacyPassPass(PassRegistry &);
void initializeMergedLoadStoreMotionLegacyPassPass(PassRegistry&);
-void initializeModuleDebugInfoLegacyPrinterPass(PassRegistry &);
void initializeModuleSummaryIndexWrapperPassPass(PassRegistry&);
void initializeModuloScheduleTestPass(PassRegistry&);
-void initializeMustExecutePrinterPass(PassRegistry&);
-void initializeMustBeExecutedContextPrinterPass(PassRegistry&);
void initializeNaryReassociateLegacyPassPass(PassRegistry&);
void initializeObjCARCContractLegacyPassPass(PassRegistry &);
void initializeOptimizationRemarkEmitterWrapperPassPass(PassRegistry&);
diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h
index 9fc7d817c53c3..7dd41b86700d4 100644
--- a/llvm/include/llvm/LinkAllPasses.h
+++ b/llvm/include/llvm/LinkAllPasses.h
@@ -146,10 +146,8 @@ namespace {
llvm::raw_string_ostream os(buf);
(void) llvm::createPrintModulePass(os);
(void) llvm::createPrintFunctionPass(os);
- (void) llvm::createModuleDebugInfoPrinterPass();
(void) llvm::createSinkingPass();
(void) llvm::createLowerAtomicPass();
- (void) llvm::createMemDepPrinter();
(void) llvm::createLoadStoreVectorizerPass();
(void) llvm::createPartiallyInlineLibCallsPass();
(void) llvm::createScalarizerPass();
@@ -158,9 +156,6 @@ namespace {
(void) llvm::createSpeculativeExecutionIfHasBranchDivergencePass();
(void) llvm::createRewriteSymbolsPass();
(void) llvm::createStraightLineStrengthReducePass();
- (void) llvm::createMemDerefPrinter();
- (void) llvm::createMustExecutePrinter();
- (void) llvm::createMustBeExecutedContextPrinter();
(void)llvm::createScalarizeMaskedMemIntrinLegacyPass();
(void) llvm::createHardwareLoopsLegacyPass();
(void) llvm::createUnifyLoopExitsPass();
diff --git a/llvm/lib/Analysis/Analysis.cpp b/llvm/lib/Analysis/Analysis.cpp
index 7fe2088e38c65..5461ce07af0b9 100644
--- a/llvm/lib/Analysis/Analysis.cpp
+++ b/llvm/lib/Analysis/Analysis.cpp
@@ -54,13 +54,8 @@ void llvm::initializeAnalysis(PassRegistry &Registry) {
initializeLazyValueInfoWrapperPassPass(Registry);
initializeLazyValueInfoPrinterPass(Registry);
initializeLoopInfoWrapperPassPass(Registry);
- initializeMemDepPrinterPass(Registry);
- initializeMemDerefPrinterPass(Registry);
initializeMemoryDependenceWrapperPassPass(Registry);
- initializeModuleDebugInfoLegacyPrinterPass(Registry);
initializeModuleSummaryIndexWrapperPassPass(Registry);
- initializeMustExecutePrinterPass(Registry);
- initializeMustBeExecutedContextPrinterPass(Registry);
initializeOptimizationRemarkEmitterWrapperPassPass(Registry);
initializePhiValuesWrapperPassPass(Registry);
initializePostDominatorTreeWrapperPassPass(Registry);
@@ -78,7 +73,6 @@ void llvm::initializeAnalysis(PassRegistry &Registry) {
initializeScopedNoAliasAAWrapperPassPass(Registry);
initializeLCSSAVerificationPassPass(Registry);
initializeMemorySSAWrapperPassPass(Registry);
- initializeMemorySSAPrinterLegacyPassPass(Registry);
}
LLVMBool LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action,
diff --git a/llvm/lib/Analysis/CMakeLists.txt b/llvm/lib/Analysis/CMakeLists.txt
index 166a83e8bbfbf..4a1797c42789a 100644
--- a/llvm/lib/Analysis/CMakeLists.txt
+++ b/llvm/lib/Analysis/CMakeLists.txt
@@ -92,7 +92,6 @@ add_llvm_component_library(LLVMAnalysis
LoopInfo.cpp
LoopPass.cpp
MLInlineAdvisor.cpp
- MemDepPrinter.cpp
MemDerefPrinter.cpp
MemoryBuiltins.cpp
MemoryDependenceAnalysis.cpp
diff --git a/llvm/lib/Analysis/MemDepPrinter.cpp b/llvm/lib/Analysis/MemDepPrinter.cpp
deleted file mode 100644
index 305ae3e2a9922..0000000000000
--- a/llvm/lib/Analysis/MemDepPrinter.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-//===- MemDepPrinter.cpp - Printer for MemoryDependenceAnalysis -----------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/ADT/SetVector.h"
-#include "llvm/Analysis/AliasAnalysis.h"
-#include "llvm/Analysis/MemoryDependenceAnalysis.h"
-#include "llvm/Analysis/Passes.h"
-#include "llvm/IR/InstIterator.h"
-#include "llvm/IR/Instructions.h"
-#include "llvm/InitializePasses.h"
-#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/raw_ostream.h"
-
-using namespace llvm;
-
-namespace {
- struct MemDepPrinter : public FunctionPass {
- const Function *F;
-
- enum DepType {
- Clobber = 0,
- Def,
- NonFuncLocal,
- Unknown
- };
-
- static const char *const DepTypeStr[];
-
- typedef PointerIntPair<const Instruction *, 2, DepType> InstTypePair;
- typedef std::pair<InstTypePair, const BasicBlock *> Dep;
- typedef SmallSetVector<Dep, 4> DepSet;
- typedef DenseMap<const Instruction *, DepSet> DepSetMap;
- DepSetMap Deps;
-
- static char ID; // Pass identifcation, replacement for typeid
- MemDepPrinter() : FunctionPass(ID) {
- initializeMemDepPrinterPass(*PassRegistry::getPassRegistry());
- }
-
- bool runOnFunction(Function &F) override;
-
- void print(raw_ostream &OS, const Module * = nullptr) const override;
-
- void getAnalysisUsage(AnalysisUsage &AU) const override {
- AU.addRequiredTransitive<AAResultsWrapperPass>();
- AU.addRequiredTransitive<MemoryDependenceWrapperPass>();
- AU.setPreservesAll();
- }
-
- void releaseMemory() override {
- Deps.clear();
- F = nullptr;
- }
-
- private:
- static InstTypePair getInstTypePair(MemDepResult dep) {
- if (dep.isClobber())
- return InstTypePair(dep.getInst(), Clobber);
- if (dep.isDef())
- return InstTypePair(dep.getInst(), Def);
- if (dep.isNonFuncLocal())
- return InstTypePair(dep.getInst(), NonFuncLocal);
- assert(dep.isUnknown() && "unexpected dependence type");
- return InstTypePair(dep.getInst(), Unknown);
- }
- };
-}
-
-char MemDepPrinter::ID = 0;
-INITIALIZE_PASS_BEGIN(MemDepPrinter, "print-memdeps",
- "Print MemDeps of function", false, true)
-INITIALIZE_PASS_DEPENDENCY(MemoryDependenceWrapperPass)
-INITIALIZE_PASS_END(MemDepPrinter, "print-memdeps",
- "Print MemDeps of function", false, true)
-
-FunctionPass *llvm::createMemDepPrinter() {
- return new MemDepPrinter();
-}
-
-const char *const MemDepPrinter::DepTypeStr[]
- = {"Clobber", "Def", "NonFuncLocal", "Unknown"};
-
-bool MemDepPrinter::runOnFunction(Function &F) {
- this->F = &F;
- MemoryDependenceResults &MDA = getAnalysis<MemoryDependenceWrapperPass>().getMemDep();
-
- // All this code uses non-const interfaces because MemDep is not
- // const-friendly, though nothing is actually modified.
- for (auto &I : instructions(F)) {
- Instruction *Inst = &I;
-
- if (!Inst->mayReadFromMemory() && !Inst->mayWriteToMemory())
- continue;
-
- MemDepResult Res = MDA.getDependency(Inst);
- if (!Res.isNonLocal()) {
- Deps[Inst].insert(std::make_pair(getInstTypePair(Res),
- static_cast<BasicBlock *>(nullptr)));
- } else if (auto *Call = dyn_cast<CallBase>(Inst)) {
- const MemoryDependenceResults::NonLocalDepInfo &NLDI =
- MDA.getNonLocalCallDependency(Call);
-
- DepSet &InstDeps = Deps[Inst];
- for (const NonLocalDepEntry &I : NLDI) {
- const MemDepResult &Res = I.getResult();
- InstDeps.insert(std::make_pair(getInstTypePair(Res), I.getBB()));
- }
- } else {
- SmallVector<NonLocalDepResult, 4> NLDI;
- assert( (isa<LoadInst>(Inst) || isa<StoreInst>(Inst) ||
- isa<VAArgInst>(Inst)) && "Unknown memory instruction!");
- MDA.getNonLocalPointerDependency(Inst, NLDI);
-
- DepSet &InstDeps = Deps[Inst];
- for (const NonLocalDepResult &I : NLDI) {
- const MemDepResult &Res = I.getResult();
- InstDeps.insert(std::make_pair(getInstTypePair(Res), I.getBB()));
- }
- }
- }
-
- return false;
-}
-
-void MemDepPrinter::print(raw_ostream &OS, const Module *M) const {
- for (const auto &I : instructions(*F)) {
- const Instruction *Inst = &I;
-
- DepSetMap::const_iterator DI = Deps.find(Inst);
- if (DI == Deps.end())
- continue;
-
- const DepSet &InstDeps = DI->second;
-
- for (const auto &I : InstDeps) {
- const Instruction *DepInst = I.first.getPointer();
- DepType type = I.first.getInt();
- const BasicBlock *DepBB = I.second;
-
- OS << " ";
- OS << DepTypeStr[type];
- if (DepBB) {
- OS << " in block ";
- DepBB->printAsOperand(OS, /*PrintType=*/false, M);
- }
- if (DepInst) {
- OS << " from: ";
- DepInst->print(OS);
- }
- OS << "\n";
- }
-
- Inst->print(OS);
- OS << "\n\n";
- }
-}
diff --git a/llvm/lib/Analysis/MemDerefPrinter.cpp b/llvm/lib/Analysis/MemDerefPrinter.cpp
index 4dd5c76cc604b..2632bc50d6e69 100644
--- a/llvm/lib/Analysis/MemDerefPrinter.cpp
+++ b/llvm/lib/Analysis/MemDerefPrinter.cpp
@@ -18,65 +18,6 @@
using namespace llvm;
-namespace {
- struct MemDerefPrinter : public FunctionPass {
- SmallVector<Value *, 4> Deref;
- SmallPtrSet<Value *, 4> DerefAndAligned;
-
- static char ID; // Pass identification, replacement for typeid
- MemDerefPrinter() : FunctionPass(ID) {
- initializeMemDerefPrinterPass(*PassRegistry::getPassRegistry());
- }
- void getAnalysisUsage(AnalysisUsage &AU) const override {
- AU.setPreservesAll();
- }
- bool runOnFunction(Function &F) override;
- void print(raw_ostream &OS, const Module * = nullptr) const override;
- void releaseMemory() override {
- Deref.clear();
- DerefAndAligned.clear();
- }
- };
-}
-
-char MemDerefPrinter::ID = 0;
-INITIALIZE_PASS_BEGIN(MemDerefPrinter, "print-memderefs",
- "Memory Dereferenciblity of pointers in function", false, true)
-INITIALIZE_PASS_END(MemDerefPrinter, "print-memderefs",
- "Memory Dereferenciblity of pointers in function", false, true)
-
-FunctionPass *llvm::createMemDerefPrinter() {
- return new MemDerefPrinter();
-}
-
-bool MemDerefPrinter::runOnFunction(Function &F) {
- const DataLayout &DL = F.getParent()->getDataLayout();
- for (auto &I: instructions(F)) {
- if (LoadInst *LI = dyn_cast<LoadInst>(&I)) {
- Value *PO = LI->getPointerOperand();
- if (isDereferenceablePointer(PO, LI->getType(), DL))
- Deref.push_back(PO);
- if (isDereferenceableAndAlignedPointer(PO, LI->getType(), LI->getAlign(),
- DL))
- DerefAndAligned.insert(PO);
- }
- }
- return false;
-}
-
-void MemDerefPrinter::print(raw_ostream &OS, const Module *M) const {
- OS << "The following are dereferenceable:\n";
- for (Value *V: Deref) {
- OS << " ";
- V->print(OS);
- if (DerefAndAligned.count(V))
- OS << "\t(aligned)";
- else
- OS << "\t(unaligned)";
- OS << "\n";
- }
-}
-
PreservedAnalyses MemDerefPrinterPass::run(Function &F,
FunctionAnalysisManager &AM) {
OS << "Memory Dereferencibility of pointers in function '" << F.getName()
diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp
index 4fb0be840e24a..6496bbc3b9f7a 100644
--- a/llvm/lib/Analysis/MemorySSA.cpp
+++ b/llvm/lib/Analysis/MemorySSA.cpp
@@ -71,12 +71,6 @@ INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)
INITIALIZE_PASS_END(MemorySSAWrapperPass, "memoryssa", "Memory SSA", false,
true)
-INITIALIZE_PASS_BEGIN(MemorySSAPrinterLegacyPass, "print-memoryssa",
- "Memory SSA Printer", false, false)
-INITIALIZE_PASS_DEPENDENCY(MemorySSAWrapperPass)
-INITIALIZE_PASS_END(MemorySSAPrinterLegacyPass, "print-memoryssa",
- "Memory SSA Printer", false, false)
-
static cl::opt<unsigned> MaxCheckLimit(
"memssa-check-limit", cl::Hidden, cl::init(100),
cl::desc("The maximum number of stores/phis MemorySSA"
@@ -2219,17 +2213,6 @@ void MemoryAccess::dump() const {
#endif
}
-char MemorySSAPrinterLegacyPass::ID = 0;
-
-MemorySSAPrinterLegacyPass::MemorySSAPrinterLegacyPass() : FunctionPass(ID) {
- initializeMemorySSAPrinterLegacyPassPass(*PassRegistry::getPassRegistry());
-}
-
-void MemorySSAPrinterLegacyPass::getAnalysisUsage(AnalysisUsage &AU) const {
- AU.setPreservesAll();
- AU.addRequired<MemorySSAWrapperPass>();
-}
-
class DOTFuncMSSAInfo {
private:
const Function &F;
@@ -2314,20 +2297,6 @@ struct DOTGraphTraits<DOTFuncMSSAInfo *> : public DefaultDOTGraphTraits {
} // namespace llvm
-bool MemorySSAPrinterLegacyPass::runOnFunction(Function &F) {
- auto &MSSA = getAnalysis<MemorySSAWrapperPass>().getMSSA();
- MSSA.ensureOptimizedUses();
- if (DotCFGMSSA != "") {
- DOTFuncMSSAInfo CFGInfo(F, MSSA);
- WriteGraph(&CFGInfo, "", false, "MSSA", DotCFGMSSA);
- } else
- MSSA.print(dbgs());
-
- if (VerifyMemorySSA)
- MSSA.verifyMemorySSA();
- return false;
-}
-
AnalysisKey MemorySSAAnalysis::Key;
MemorySSAAnalysis::Result MemorySSAAnalysis::run(Function &F,
diff --git a/llvm/lib/Analysis/ModuleDebugInfoPrinter.cpp b/llvm/lib/Analysis/ModuleDebugInfoPrinter.cpp
index 756f92e1aac47..919f8f5c01d67 100644
--- a/llvm/lib/Analysis/ModuleDebugInfoPrinter.cpp
+++ b/llvm/lib/Analysis/ModuleDebugInfoPrinter.cpp
@@ -25,39 +25,6 @@
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
-namespace {
-class ModuleDebugInfoLegacyPrinter : public ModulePass {
- DebugInfoFinder Finder;
-
-public:
- static char ID; // Pass identification, replacement for typeid
- ModuleDebugInfoLegacyPrinter() : ModulePass(ID) {
- initializeModuleDebugInfoLegacyPrinterPass(
- *PassRegistry::getPassRegistry());
- }
-
- bool runOnModule(Module &M) override;
-
- void getAnalysisUsage(AnalysisUsage &AU) const override {
- AU.setPreservesAll();
- }
- void print(raw_ostream &O, const Module *M) const override;
-};
-}
-
-char ModuleDebugInfoLegacyPrinter::ID = 0;
-INITIALIZE_PASS(ModuleDebugInfoLegacyPrinter, "module-debuginfo",
- "Decodes module-level debug info", false, true)
-
-ModulePass *llvm::createModuleDebugInfoPrinterPass() {
- return new ModuleDebugInfoLegacyPrinter();
-}
-
-bool ModuleDebugInfoLegacyPrinter::runOnModule(Module &M) {
- Finder.processModule(M);
- return false;
-}
-
static void printFile(raw_ostream &O, StringRef Filename, StringRef Directory,
unsigned Line = 0) {
if (Filename.empty())
@@ -132,11 +99,6 @@ static void printModuleDebugInfo(raw_ostream &O, const Module *M,
}
}
-void ModuleDebugInfoLegacyPrinter::print(raw_ostream &O,
- const Module *M) const {
- printModuleDebugInfo(O, M, Finder);
-}
-
ModuleDebugInfoPrinterPass::ModuleDebugInfoPrinterPass(raw_ostream &OS)
: OS(OS) {}
diff --git a/llvm/lib/Analysis/MustExecute.cpp b/llvm/lib/Analysis/MustExecute.cpp
index 2f68996e1c608..d4b31f2b00187 100644
--- a/llvm/lib/Analysis/MustExecute.cpp
+++ b/llvm/lib/Analysis/MustExecute.cpp
@@ -309,101 +309,6 @@ bool ICFLoopSafetyInfo::doesNotWriteMemoryBefore(const Instruction &I,
doesNotWriteMemoryBefore(BB, CurLoop);
}
-namespace {
-struct MustExecutePrinter : public FunctionPass {
-
- static char ID; // Pass identification, replacement for typeid
- MustExecutePrinter() : FunctionPass(ID) {
- initializeMustExecutePrinterPass(*PassRegistry::getPassRegistry());
- }
- void getAnalysisUsage(AnalysisUsage &AU) const override {
- AU.setPreservesAll();
- AU.addRequired<DominatorTreeWrapperPass>();
- AU.addRequired<LoopInfoWrapperPass>();
- }
- bool runOnFunction(Function &F) override;
-};
-struct MustBeExecutedContextPrinter : public ModulePass {
- static char ID;
-
- MustBeExecutedContextPrinter() : ModulePass(ID) {
- initializeMustBeExecutedContextPrinterPass(
- *PassRegistry::getPassRegistry());
- }
- void getAnalysisUsage(AnalysisUsage &AU) const override {
- AU.setPreservesAll();
- }
- bool runOnModule(Module &M) override;
-};
-}
-
-char MustExecutePrinter::ID = 0;
-INITIALIZE_PASS_BEGIN(MustExecutePrinter, "print-mustexecute",
- "Instructions which execute on loop entry", false, true)
-INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
-INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass)
-INITIALIZE_PASS_END(MustExecutePrinter, "print-mustexecute",
- "Instructions which execute on loop entry", false, true)
-
-FunctionPass *llvm::createMustExecutePrinter() {
- return new MustExecutePrinter();
-}
-
-char MustBeExecutedContextPrinter::ID = 0;
-INITIALIZE_PASS_BEGIN(MustBeExecutedContextPrinter,
- "print-must-be-executed-contexts",
- "print the must-be-executed-context for all instructions",
- false, true)
-INITIALIZE_PASS_DEPENDENCY(PostDominatorTreeWrapperPass)
-INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
-INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass)
-INITIALIZE_PASS_END(MustBeExecutedContextPrinter,
- "print-must-be-executed-contexts",
- "print the must-be-executed-context for all instructions",
- false, true)
-
-ModulePass *llvm::createMustBeExecutedContextPrinter() {
- return new MustBeExecutedContextPrinter();
-}
-
-bool MustBeExecutedContextPrinter::runOnModule(Module &M) {
- // We provide non-PM analysis here because the old PM doesn't like to query
- // function passes from a module pass.
- SmallVector<std::unique_ptr<PostDominatorTree>, 8> PDTs;
- SmallVector<std::unique_ptr<DominatorTree>, 8> DTs;
- SmallVector<std::unique_ptr<LoopInfo>, 8> LIs;
-
- GetterTy<LoopInfo> LIGetter = [&](const Function &F) {
- DTs.push_back(std::make_unique<DominatorTree>(const_cast<Function &>(F)));
- LIs.push_back(std::make_unique<LoopInfo>(*DTs.back()));
- return LIs.back().get();
- };
- GetterTy<DominatorTree> DTGetter = [&](const Function &F) {
- DTs.push_back(std::make_unique<DominatorTree>(const_cast<Function&>(F)));
- return DTs.back().get();
- };
- GetterTy<PostDominatorTree> PDTGetter = [&](const Function &F) {
- PDTs.push_back(
- std::make_unique<PostDominatorTree>(const_cast<Function &>(F)));
- return PDTs.back().get();
- };
- MustBeExecutedContextExplorer Explorer(
- /* ExploreInterBlock */ true,
- /* ExploreCFGForward */ true,
- /* ExploreCFGBackward */ true, LIGetter, DTGetter, PDTGetter);
-
- for (Function &F : M) {
- for (Instruction &I : instructions(F)) {
- dbgs() << "-- Explore context of: " << I << "\n";
- for (const Instruction *CI : Explorer.range(&I))
- dbgs() << " [F: " << CI->getFunction()->getName() << "] " << *CI
- << "\n";
- }
- }
-
- return false;
-}
-
static bool isMustExecuteIn(const Instruction &I, Loop *L, DominatorTree *DT) {
// TODO: merge these two routines. For the moment, we display the best
// result obtained by *either* implementation. This is a bit unfair since no
@@ -467,16 +372,6 @@ class MustExecuteAnnotatedWriter : public AssemblyAnnotationWriter {
};
} // namespace
-bool MustExecutePrinter::runOnFunction(Function &F) {
- auto &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
- auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
-
- MustExecuteAnnotatedWriter Writer(F, DT, LI);
- F.print(dbgs(), &Writer);
-
- return false;
-}
-
/// Return true if \p L might be an endless loop.
static bool maybeEndlessLoop(const Loop &L) {
if (L.getHeader()->getParent()->hasFnAttribute(Attribute::WillReturn))
diff --git a/llvm/utils/gn/secondary/llvm/lib/Analysis/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Analysis/BUILD.gn
index 3076eb6067f45..2150dd02dca47 100644
--- a/llvm/utils/gn/secondary/llvm/lib/Analysis/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/Analysis/BUILD.gn
@@ -81,7 +81,6 @@ static_library("Analysis") {
"LoopPass.cpp",
"LoopUnrollAnalyzer.cpp",
"MLInlineAdvisor.cpp",
- "MemDepPrinter.cpp",
"MemDerefPrinter.cpp",
"MemoryBuiltins.cpp",
"MemoryDependenceAnalysis.cpp",
More information about the llvm-commits
mailing list