[llvm] [NewPM] Remove CFGPrinterLegacyPass (PR #73414)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 25 14:48:35 PST 2023
https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/73414
This pass has no test coverage in upstream LLVM, is not used anywhere in upstream LLVM, and has a NewPM equivalent. For these reasons, remove it.
>From 55e97c50e0ebfdfe753e185b8ec73e17c6732be2 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <agrossman154 at yahoo.com>
Date: Sat, 25 Nov 2023 14:46:51 -0800
Subject: [PATCH] [NewPM] Remove CFGPrinterLegacyPass
This pass has no test coverage in upstream LLVM, is not used anywhere in
upstream LLVM, and has a NewPM equivalent. For these reasons, remove it.
---
llvm/include/llvm/Analysis/CFGPrinter.h | 1 -
llvm/include/llvm/InitializePasses.h | 1 -
llvm/lib/Analysis/Analysis.cpp | 1 -
llvm/lib/Analysis/CFGPrinter.cpp | 35 -------------------------
4 files changed, 38 deletions(-)
diff --git a/llvm/include/llvm/Analysis/CFGPrinter.h b/llvm/include/llvm/Analysis/CFGPrinter.h
index 884dd857c82b180..e12bd7bc45b796f 100644
--- a/llvm/include/llvm/Analysis/CFGPrinter.h
+++ b/llvm/include/llvm/Analysis/CFGPrinter.h
@@ -344,7 +344,6 @@ struct DOTGraphTraits<DOTFuncInfo *> : public DefaultDOTGraphTraits {
namespace llvm {
class FunctionPass;
-FunctionPass *createCFGPrinterLegacyPassPass();
FunctionPass *createCFGOnlyPrinterLegacyPassPass();
} // End llvm namespace
diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h
index 05122ea98d8ca52..6c79544a4f83ec1 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -67,7 +67,6 @@ void initializeBreakFalseDepsPass(PassRegistry&);
void initializeCanonicalizeFreezeInLoopsPass(PassRegistry &);
void initializeCFGOnlyPrinterLegacyPassPass(PassRegistry&);
void initializeCFGOnlyViewerLegacyPassPass(PassRegistry&);
-void initializeCFGPrinterLegacyPassPass(PassRegistry&);
void initializeCFGSimplifyPassPass(PassRegistry&);
void initializeCFGuardPass(PassRegistry&);
void initializeCFGuardLongjmpPass(PassRegistry&);
diff --git a/llvm/lib/Analysis/Analysis.cpp b/llvm/lib/Analysis/Analysis.cpp
index 1fa14b005d37609..2876c3b8823bb17 100644
--- a/llvm/lib/Analysis/Analysis.cpp
+++ b/llvm/lib/Analysis/Analysis.cpp
@@ -26,7 +26,6 @@ void llvm::initializeAnalysis(PassRegistry &Registry) {
initializeCallGraphPrinterLegacyPassPass(Registry);
initializeCallGraphViewerPass(Registry);
initializeCFGViewerLegacyPassPass(Registry);
- initializeCFGPrinterLegacyPassPass(Registry);
initializeCFGOnlyViewerLegacyPassPass(Registry);
initializeCFGOnlyPrinterLegacyPassPass(Registry);
initializeCycleInfoWrapperPassPass(Registry);
diff --git a/llvm/lib/Analysis/CFGPrinter.cpp b/llvm/lib/Analysis/CFGPrinter.cpp
index 9f55371f259b2cf..5f5ec8ab1eb136d 100644
--- a/llvm/lib/Analysis/CFGPrinter.cpp
+++ b/llvm/lib/Analysis/CFGPrinter.cpp
@@ -173,37 +173,6 @@ PreservedAnalyses CFGOnlyViewerPass::run(Function &F,
return PreservedAnalyses::all();
}
-namespace {
-struct CFGPrinterLegacyPass : public FunctionPass {
- static char ID; // Pass identification, replacement for typeid
- CFGPrinterLegacyPass() : FunctionPass(ID) {
- initializeCFGPrinterLegacyPassPass(*PassRegistry::getPassRegistry());
- }
-
- bool runOnFunction(Function &F) override {
- if (!CFGFuncName.empty() && !F.getName().contains(CFGFuncName))
- return false;
- auto *BPI = &getAnalysis<BranchProbabilityInfoWrapperPass>().getBPI();
- auto *BFI = &getAnalysis<BlockFrequencyInfoWrapperPass>().getBFI();
- writeCFGToDotFile(F, BFI, BPI, getMaxFreq(F, BFI));
- return false;
- }
-
- void print(raw_ostream &OS, const Module * = nullptr) const override {}
-
- void getAnalysisUsage(AnalysisUsage &AU) const override {
- FunctionPass::getAnalysisUsage(AU);
- AU.addRequired<BlockFrequencyInfoWrapperPass>();
- AU.addRequired<BranchProbabilityInfoWrapperPass>();
- AU.setPreservesAll();
- }
-};
-} // namespace
-
-char CFGPrinterLegacyPass::ID = 0;
-INITIALIZE_PASS(CFGPrinterLegacyPass, "dot-cfg",
- "Print CFG of function to 'dot' file", false, true)
-
PreservedAnalyses CFGPrinterPass::run(Function &F,
FunctionAnalysisManager &AM) {
if (!CFGFuncName.empty() && !F.getName().contains(CFGFuncName))
@@ -282,10 +251,6 @@ void Function::viewCFGOnly(const BlockFrequencyInfo *BFI,
viewCFG(true, BFI, BPI);
}
-FunctionPass *llvm::createCFGPrinterLegacyPassPass() {
- return new CFGPrinterLegacyPass();
-}
-
FunctionPass *llvm::createCFGOnlyPrinterLegacyPassPass() {
return new CFGOnlyPrinterLegacyPass();
}
More information about the llvm-commits
mailing list