[PATCH] D118338: [Debugify] Override printPipeline for NewPM debugify passes
Bjorn Pettersson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 27 02:49:57 PST 2022
bjope created this revision.
bjope added reviewers: aeubanks, djtodoro, markus.
Herald added a subscriber: hiraditya.
bjope requested review of this revision.
Herald added a project: LLVM.
Make sure NewPM versions of debugify and check-debugify present
themselves correctly when using -print-pipeline-passes option
in opt.
For some reason those passes aren't in the PassRegistry. So they
still won't be listed when using "opt -print-passes". I do not know
much about the reasoning and why it is like that, therefore this
patch just fixes the problem with -print-pipeline-passes by simple
overrides of the printPipeline function.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D118338
Files:
llvm/include/llvm/Transforms/Utils/Debugify.h
llvm/lib/Transforms/Utils/Debugify.cpp
llvm/test/Other/new-pm-print-pipeline.ll
Index: llvm/test/Other/new-pm-print-pipeline.ll
===================================================================
--- llvm/test/Other/new-pm-print-pipeline.ll
+++ llvm/test/Other/new-pm-print-pipeline.ll
@@ -73,3 +73,8 @@
;; Test that the loop-nest-pass lnicm is printed with the other loop-passes in the pipeline.
; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='function(loop-mssa(licm,loop-rotate,loop-deletion,lnicm,loop-rotate))' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-23
; CHECK-23: function(loop-mssa(licm,loop-rotate,loop-deletion,lnicm,loop-rotate))
+
+;; Test that -debugify and -check-debugify is printed correctly.
+; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='debugify,sroa,check-debugify' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-24
+; RUN: opt -disable-output -disable-verify -print-pipeline-passes -enable-debugify -passes='sroa' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-24
+; CHECK-24: debugify,function(sroa),check-debugify
\ No newline at end of file
Index: llvm/lib/Transforms/Utils/Debugify.cpp
===================================================================
--- llvm/lib/Transforms/Utils/Debugify.cpp
+++ llvm/lib/Transforms/Utils/Debugify.cpp
@@ -946,6 +946,13 @@
return PreservedAnalyses::all();
}
+void NewPMDebugifyPass::printPipeline(
+ raw_ostream &OS, function_ref<StringRef(StringRef)> MapClassName2PassName) {
+ // The debugify pass is not included in the PassRegistry. Just print the pass
+ // name directly.
+ OS << "debugify";
+}
+
ModulePass *createCheckDebugifyModulePass(
bool Strip, StringRef NameOfWrappedPass, DebugifyStatsMap *StatsMap,
enum DebugifyMode Mode, DebugInfoPerPassMap *DIPreservationMap,
@@ -977,6 +984,13 @@
return PreservedAnalyses::all();
}
+void NewPMCheckDebugifyPass::printPipeline(
+ raw_ostream &OS, function_ref<StringRef(StringRef)> MapClassName2PassName) {
+ // The check-debugify pass is not included in the PassRegistry. Just print the
+ // pass name directly.
+ OS << "check-debugify";
+}
+
static bool isIgnoredPass(StringRef PassID) {
return isSpecialPass(PassID, {"PassManager", "PassAdaptor",
"AnalysisManagerProxy", "PrintFunctionPass",
Index: llvm/include/llvm/Transforms/Utils/Debugify.h
===================================================================
--- llvm/include/llvm/Transforms/Utils/Debugify.h
+++ llvm/include/llvm/Transforms/Utils/Debugify.h
@@ -104,6 +104,9 @@
struct NewPMDebugifyPass : public llvm::PassInfoMixin<NewPMDebugifyPass> {
llvm::PreservedAnalyses run(llvm::Module &M, llvm::ModuleAnalysisManager &AM);
+ void printPipeline(llvm::raw_ostream &OS,
+ llvm::function_ref<llvm::StringRef(llvm::StringRef)>
+ MapClassName2PassName);
};
/// Track how much `debugify` information (in the `synthetic` mode only)
@@ -152,6 +155,9 @@
struct NewPMCheckDebugifyPass
: public llvm::PassInfoMixin<NewPMCheckDebugifyPass> {
llvm::PreservedAnalyses run(llvm::Module &M, llvm::ModuleAnalysisManager &AM);
+ void printPipeline(llvm::raw_ostream &OS,
+ llvm::function_ref<llvm::StringRef(llvm::StringRef)>
+ MapClassName2PassName);
};
namespace llvm {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118338.403559.patch
Type: text/x-patch
Size: 3350 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220127/3f00cd1c/attachment.bin>
More information about the llvm-commits
mailing list