[llvm] [MachineDominator] Align with IR version (PR #97214)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 30 06:10:31 PDT 2024


https://github.com/paperchalice created https://github.com/llvm/llvm-project/pull/97214

- Mark constructor explicit.
- Provide `isRequired`.

>From f0c6e9916efc19760de4d92b8ba1c9b90efff561 Mon Sep 17 00:00:00 2001
From: PaperChalice <liujunchang97 at outlook.com>
Date: Sun, 30 Jun 2024 21:07:52 +0800
Subject: [PATCH] [MachineDominator] Align with IR version - Mark constructor
 explicit. - Provide `isRequired`.

---
 llvm/include/llvm/CodeGen/MachineDominators.h     | 3 ++-
 llvm/include/llvm/CodeGen/MachinePostDominators.h | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/llvm/include/llvm/CodeGen/MachineDominators.h b/llvm/include/llvm/CodeGen/MachineDominators.h
index 01f3783a4ffb4..74cf94398736d 100644
--- a/llvm/include/llvm/CodeGen/MachineDominators.h
+++ b/llvm/include/llvm/CodeGen/MachineDominators.h
@@ -286,9 +286,10 @@ class MachineDominatorTreePrinterPass
   raw_ostream &OS;
 
 public:
-  MachineDominatorTreePrinterPass(raw_ostream &OS) : OS(OS) {}
+  explicit MachineDominatorTreePrinterPass(raw_ostream &OS) : OS(OS) {}
   PreservedAnalyses run(MachineFunction &MF,
                         MachineFunctionAnalysisManager &MFAM);
+  static bool isRequired() { return true; }
 };
 
 /// \brief Analysis pass which computes a \c MachineDominatorTree.
diff --git a/llvm/include/llvm/CodeGen/MachinePostDominators.h b/llvm/include/llvm/CodeGen/MachinePostDominators.h
index 7769d4b426c7a..1d37272e0315f 100644
--- a/llvm/include/llvm/CodeGen/MachinePostDominators.h
+++ b/llvm/include/llvm/CodeGen/MachinePostDominators.h
@@ -81,9 +81,10 @@ class MachinePostDominatorTreePrinterPass
   raw_ostream &OS;
 
 public:
-  MachinePostDominatorTreePrinterPass(raw_ostream &OS) : OS(OS) {}
+  explicit MachinePostDominatorTreePrinterPass(raw_ostream &OS) : OS(OS) {}
   PreservedAnalyses run(MachineFunction &MF,
                         MachineFunctionAnalysisManager &MFAM);
+  static bool isRequired() { return true; }
 };
 
 class MachinePostDominatorTreeWrapperPass : public MachineFunctionPass {



More information about the llvm-commits mailing list