[llvm] [NewPM] Remove CFGViewerLegacyPass (PR #73410)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 25 14:31:57 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-analysis
Author: Aiden Grossman (boomanaiden154)
<details>
<summary>Changes</summary>
This pass isn't used anywhere upstream, has a NewPM equivalent, and has no test coverage. For these reasons, remove it.
---
Full diff: https://github.com/llvm/llvm-project/pull/73410.diff
3 Files Affected:
- (modified) llvm/include/llvm/InitializePasses.h (-1)
- (modified) llvm/lib/Analysis/Analysis.cpp (-1)
- (modified) llvm/lib/Analysis/CFGPrinter.cpp (-31)
``````````diff
diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h
index 05122ea98d8ca52..d2d69446782dd10 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -71,7 +71,6 @@ void initializeCFGPrinterLegacyPassPass(PassRegistry&);
void initializeCFGSimplifyPassPass(PassRegistry&);
void initializeCFGuardPass(PassRegistry&);
void initializeCFGuardLongjmpPass(PassRegistry&);
-void initializeCFGViewerLegacyPassPass(PassRegistry&);
void initializeCFIFixupPass(PassRegistry&);
void initializeCFIInstrInserterPass(PassRegistry&);
void initializeCallBrPreparePass(PassRegistry &);
diff --git a/llvm/lib/Analysis/Analysis.cpp b/llvm/lib/Analysis/Analysis.cpp
index 1fa14b005d37609..e28e0d8f4a775fd 100644
--- a/llvm/lib/Analysis/Analysis.cpp
+++ b/llvm/lib/Analysis/Analysis.cpp
@@ -25,7 +25,6 @@ void llvm::initializeAnalysis(PassRegistry &Registry) {
initializeCallGraphDOTPrinterPass(Registry);
initializeCallGraphPrinterLegacyPassPass(Registry);
initializeCallGraphViewerPass(Registry);
- initializeCFGViewerLegacyPassPass(Registry);
initializeCFGPrinterLegacyPassPass(Registry);
initializeCFGOnlyViewerLegacyPassPass(Registry);
initializeCFGOnlyPrinterLegacyPassPass(Registry);
diff --git a/llvm/lib/Analysis/CFGPrinter.cpp b/llvm/lib/Analysis/CFGPrinter.cpp
index 9f55371f259b2cf..80a99fa0671067e 100644
--- a/llvm/lib/Analysis/CFGPrinter.cpp
+++ b/llvm/lib/Analysis/CFGPrinter.cpp
@@ -92,37 +92,6 @@ static void viewCFG(Function &F, const BlockFrequencyInfo *BFI,
ViewGraph(&CFGInfo, "cfg." + F.getName(), CFGOnly);
}
-namespace {
-struct CFGViewerLegacyPass : public FunctionPass {
- static char ID; // Pass identifcation, replacement for typeid
- CFGViewerLegacyPass() : FunctionPass(ID) {
- initializeCFGViewerLegacyPassPass(*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();
- viewCFG(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 CFGViewerLegacyPass::ID = 0;
-INITIALIZE_PASS(CFGViewerLegacyPass, "view-cfg", "View CFG of function", false,
- true)
-
PreservedAnalyses CFGViewerPass::run(Function &F, FunctionAnalysisManager &AM) {
if (!CFGFuncName.empty() && !F.getName().contains(CFGFuncName))
return PreservedAnalyses::all();
``````````
</details>
https://github.com/llvm/llvm-project/pull/73410
More information about the llvm-commits
mailing list