[llvm] [CodeGen] Add no-op machine function pass for test purpose (PR #79541)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 25 18:44:57 PST 2024
https://github.com/paperchalice created https://github.com/llvm/llvm-project/pull/79541
None
>From d14384b4d132e8a0bde39e8d2228981421c4d1ae Mon Sep 17 00:00:00 2001
From: PaperChalice <liujunchang97 at outlook.com>
Date: Fri, 26 Jan 2024 10:41:10 +0800
Subject: [PATCH] [CodeGen] Add no-op machine function pass for test purpose
---
llvm/include/llvm/Passes/MachinePassRegistry.def | 1 +
llvm/include/llvm/Passes/PassBuilder.h | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/llvm/include/llvm/Passes/MachinePassRegistry.def b/llvm/include/llvm/Passes/MachinePassRegistry.def
index ffea0ffd304549..9df3bae107b17e 100644
--- a/llvm/include/llvm/Passes/MachinePassRegistry.def
+++ b/llvm/include/llvm/Passes/MachinePassRegistry.def
@@ -127,6 +127,7 @@ MACHINE_FUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis,
#endif
// MACHINE_FUNCTION_PASS("free-machine-function", FreeMachineFunctionPass, ())
// MACHINE_FUNCTION_PASS("mir-printer", PrintMIRPass, ())
+MACHINE_FUNCTION_PASS("no-op-machine-function", NoOpMachineFunctionPass, ())
#undef MACHINE_FUNCTION_PASS
// After a pass is converted to new pass manager, its entry should be moved from
diff --git a/llvm/include/llvm/Passes/PassBuilder.h b/llvm/include/llvm/Passes/PassBuilder.h
index 7339b8a988232d..10c5b7c00bae33 100644
--- a/llvm/include/llvm/Passes/PassBuilder.h
+++ b/llvm/include/llvm/Passes/PassBuilder.h
@@ -852,6 +852,14 @@ struct NoOpLoopPass : PassInfoMixin<NoOpLoopPass> {
}
};
+/// No-op machine function pass which does nothing.
+struct NoOpMachineFunctionPass
+ : public MachinePassInfoMixin<NoOpMachineFunctionPass> {
+ PreservedAnalyses run(MachineFunction &, MachineFunctionAnalysisManager &) {
+ return PreservedAnalyses::all();
+ }
+};
+
/// No-op loop analysis.
class NoOpLoopAnalysis : public AnalysisInfoMixin<NoOpLoopAnalysis> {
friend AnalysisInfoMixin<NoOpLoopAnalysis>;
More information about the llvm-commits
mailing list