-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[NFC][LLVM][RISCV] Cleanup pass initialization for RISCV #134279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
jurahul
commented
Apr 3, 2025
- Move calls to pass initialization functions to RISCV target initialization and remove them from pass constructors.
- Move calls to pass initialization functions to RISCV target initialization and remove them from pass constructors.
topperc
approved these changes
Apr 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks! |
@llvm/pr-subscribers-backend-risc-v Author: Rahul Joshi (jurahul) Changes
Full diff: https://github.com/llvm/llvm-project/pull/134279.diff 6 Files Affected:
diff --git a/llvm/lib/Target/RISCV/GISel/RISCVO0PreLegalizerCombiner.cpp b/llvm/lib/Target/RISCV/GISel/RISCVO0PreLegalizerCombiner.cpp
index b3f27ea95b79c..1450d5f092f9c 100644
--- a/llvm/lib/Target/RISCV/GISel/RISCVO0PreLegalizerCombiner.cpp
+++ b/llvm/lib/Target/RISCV/GISel/RISCVO0PreLegalizerCombiner.cpp
@@ -110,8 +110,6 @@ void RISCVO0PreLegalizerCombiner::getAnalysisUsage(AnalysisUsage &AU) const {
RISCVO0PreLegalizerCombiner::RISCVO0PreLegalizerCombiner()
: MachineFunctionPass(ID) {
- initializeRISCVO0PreLegalizerCombinerPass(*PassRegistry::getPassRegistry());
-
if (!RuleConfig.parseCommandLineOption())
report_fatal_error("Invalid rule identifier");
}
@@ -150,8 +148,6 @@ INITIALIZE_PASS_END(RISCVO0PreLegalizerCombiner, DEBUG_TYPE,
"Combine RISC-V machine instrs before legalization", false,
false)
-namespace llvm {
-FunctionPass *createRISCVO0PreLegalizerCombiner() {
+FunctionPass *llvm::createRISCVO0PreLegalizerCombiner() {
return new RISCVO0PreLegalizerCombiner();
}
-} // end namespace llvm
diff --git a/llvm/lib/Target/RISCV/GISel/RISCVPostLegalizerCombiner.cpp b/llvm/lib/Target/RISCV/GISel/RISCVPostLegalizerCombiner.cpp
index 29136d8b8bf04..eaccf6d67dcc4 100644
--- a/llvm/lib/Target/RISCV/GISel/RISCVPostLegalizerCombiner.cpp
+++ b/llvm/lib/Target/RISCV/GISel/RISCVPostLegalizerCombiner.cpp
@@ -118,8 +118,6 @@ void RISCVPostLegalizerCombiner::getAnalysisUsage(AnalysisUsage &AU) const {
RISCVPostLegalizerCombiner::RISCVPostLegalizerCombiner()
: MachineFunctionPass(ID) {
- initializeRISCVPostLegalizerCombinerPass(*PassRegistry::getPassRegistry());
-
if (!RuleConfig.parseCommandLineOption())
report_fatal_error("Invalid rule identifier");
}
@@ -164,8 +162,6 @@ INITIALIZE_PASS_END(RISCVPostLegalizerCombiner, DEBUG_TYPE,
"Combine RISC-V MachineInstrs after legalization", false,
false)
-namespace llvm {
-FunctionPass *createRISCVPostLegalizerCombiner() {
+FunctionPass *llvm::createRISCVPostLegalizerCombiner() {
return new RISCVPostLegalizerCombiner();
}
-} // end namespace llvm
diff --git a/llvm/lib/Target/RISCV/GISel/RISCVPreLegalizerCombiner.cpp b/llvm/lib/Target/RISCV/GISel/RISCVPreLegalizerCombiner.cpp
index 0c5a09a925bb6..afd25676a89eb 100644
--- a/llvm/lib/Target/RISCV/GISel/RISCVPreLegalizerCombiner.cpp
+++ b/llvm/lib/Target/RISCV/GISel/RISCVPreLegalizerCombiner.cpp
@@ -116,8 +116,6 @@ void RISCVPreLegalizerCombiner::getAnalysisUsage(AnalysisUsage &AU) const {
RISCVPreLegalizerCombiner::RISCVPreLegalizerCombiner()
: MachineFunctionPass(ID) {
- initializeRISCVPreLegalizerCombinerPass(*PassRegistry::getPassRegistry());
-
if (!RuleConfig.parseCommandLineOption())
report_fatal_error("Invalid rule identifier");
}
@@ -167,8 +165,6 @@ INITIALIZE_PASS_END(RISCVPreLegalizerCombiner, DEBUG_TYPE,
"Combine RISC-V machine instrs before legalization", false,
false)
-namespace llvm {
-FunctionPass *createRISCVPreLegalizerCombiner() {
+FunctionPass *llvm::createRISCVPreLegalizerCombiner() {
return new RISCVPreLegalizerCombiner();
}
-} // end namespace llvm
diff --git a/llvm/lib/Target/RISCV/RISCVExpandAtomicPseudoInsts.cpp b/llvm/lib/Target/RISCV/RISCVExpandAtomicPseudoInsts.cpp
index bb772fc5da922..a537904b27744 100644
--- a/llvm/lib/Target/RISCV/RISCVExpandAtomicPseudoInsts.cpp
+++ b/llvm/lib/Target/RISCV/RISCVExpandAtomicPseudoInsts.cpp
@@ -34,9 +34,7 @@ class RISCVExpandAtomicPseudo : public MachineFunctionPass {
const RISCVInstrInfo *TII;
static char ID;
- RISCVExpandAtomicPseudo() : MachineFunctionPass(ID) {
- initializeRISCVExpandAtomicPseudoPass(*PassRegistry::getPassRegistry());
- }
+ RISCVExpandAtomicPseudo() : MachineFunctionPass(ID) {}
bool runOnMachineFunction(MachineFunction &MF) override;
@@ -733,10 +731,6 @@ bool RISCVExpandAtomicPseudo::expandAtomicCmpXchg(
INITIALIZE_PASS(RISCVExpandAtomicPseudo, "riscv-expand-atomic-pseudo",
RISCV_EXPAND_ATOMIC_PSEUDO_NAME, false, false)
-namespace llvm {
-
-FunctionPass *createRISCVExpandAtomicPseudoPass() {
+FunctionPass *llvm::createRISCVExpandAtomicPseudoPass() {
return new RISCVExpandAtomicPseudo();
}
-
-} // end of namespace llvm
diff --git a/llvm/lib/Target/RISCV/RISCVRedundantCopyElimination.cpp b/llvm/lib/Target/RISCV/RISCVRedundantCopyElimination.cpp
index 65ff67b424796..167db9f50bcb8 100644
--- a/llvm/lib/Target/RISCV/RISCVRedundantCopyElimination.cpp
+++ b/llvm/lib/Target/RISCV/RISCVRedundantCopyElimination.cpp
@@ -44,10 +44,7 @@ class RISCVRedundantCopyElimination : public MachineFunctionPass {
public:
static char ID;
- RISCVRedundantCopyElimination() : MachineFunctionPass(ID) {
- initializeRISCVRedundantCopyEliminationPass(
- *PassRegistry::getPassRegistry());
- }
+ RISCVRedundantCopyElimination() : MachineFunctionPass(ID) {}
bool runOnMachineFunction(MachineFunction &MF) override;
MachineFunctionProperties getRequiredProperties() const override {
diff --git a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
index ec8ba3322a6e1..7fb64be3975d5 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
@@ -147,6 +147,8 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeRISCVTarget() {
initializeRISCVMoveMergePass(*PR);
initializeRISCVPushPopOptPass(*PR);
initializeRISCVLoadStoreOptPass(*PR);
+ initializeRISCVExpandAtomicPseudoPass(*PR);
+ initializeRISCVRedundantCopyEliminationPass(*PR);
}
static StringRef computeDataLayout(const Triple &TT,
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.