[llvm-branch-commits] [llvm] [RISCV] Port Opt W Instrs to NewPM (PR #215673)
Sam Elliott via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Aug 20 21:46:13 PDT 2026
https://github.com/lenary updated https://github.com/llvm/llvm-project/pull/215673
>From b7201494e61d7f64601ce3e0185c873f8a26d1cb Mon Sep 17 00:00:00 2001
From: Sam Elliott <aelliott at qti.qualcomm.com>
Date: Fri, 7 Aug 2026 17:02:37 -0700
Subject: [PATCH 1/2] [RISCV] Port Opt W Instrs to NewPM
Assisted-by: AI
---
.../Target/RISCV/RISCVCodeGenPassBuilder.cpp | 5 +-
llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp | 66 ++++++++++++-------
llvm/lib/Target/RISCV/RISCVOptWInstrs.h | 35 ++++++++++
llvm/lib/Target/RISCV/RISCVPassRegistry.def | 1 +
llvm/lib/Target/RISCV/RISCVTargetMachine.cpp | 3 +-
llvm/test/CodeGen/RISCV/O1-newpm-pipeline.ll | 3 +-
llvm/test/CodeGen/RISCV/O3-newpm-pipeline.ll | 3 +-
.../test/CodeGen/RISCV/opt-w-instrs-p-ext.mir | 1 +
llvm/test/CodeGen/RISCV/opt-w-instrs.mir | 1 +
llvm/test/CodeGen/RISCV/prefer-w-inst.mir | 4 ++
.../CodeGen/RISCV/sextw-removal-debug.mir | 1 +
llvm/test/CodeGen/RISCV/zilx-opt-w-instrs.mir | 1 +
12 files changed, 96 insertions(+), 28 deletions(-)
create mode 100644 llvm/lib/Target/RISCV/RISCVOptWInstrs.h
diff --git a/llvm/lib/Target/RISCV/RISCVCodeGenPassBuilder.cpp b/llvm/lib/Target/RISCV/RISCVCodeGenPassBuilder.cpp
index 52bd413aa424f..f51b44776e916 100644
--- a/llvm/lib/Target/RISCV/RISCVCodeGenPassBuilder.cpp
+++ b/llvm/lib/Target/RISCV/RISCVCodeGenPassBuilder.cpp
@@ -118,9 +118,8 @@ void RISCVCodeGenPassBuilder::addMachineSSAOptimization(
Base::addMachineSSAOptimization(PMW);
- if (TM.getTargetTriple().isRISCV64()) {
- // TODO: RISCVOptWInstrsPass
- }
+ if (TM.getTargetTriple().isRISCV64())
+ addMachineFunctionPass(RISCVOptWInstrsPass(), PMW);
}
void RISCVCodeGenPassBuilder::addPreRegAlloc(PassManagerWrapper &PMW) {
diff --git a/llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp b/llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp
index 0b50bab121abd..335316941b020 100644
--- a/llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp
+++ b/llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp
@@ -32,7 +32,7 @@
// * ld/lwu.
//===---------------------------------------------------------------------===//
-#include "RISCV.h"
+#include "RISCVOptWInstrs.h"
#include "RISCVMachineFunctionInfo.h"
#include "RISCVSubtarget.h"
#include "llvm/ADT/SmallSet.h"
@@ -60,18 +60,25 @@ static cl::opt<bool> DisableStripWSuffix("riscv-disable-strip-w-suffix",
namespace {
-class RISCVOptWInstrs : public MachineFunctionPass {
+class RISCVOptWInstrsImpl {
public:
- static char ID;
-
- RISCVOptWInstrs() : MachineFunctionPass(ID) {}
+ bool run(MachineFunction &MF);
- bool runOnMachineFunction(MachineFunction &MF) override;
+private:
bool removeSExtWInstrs(MachineFunction &MF, const RISCVInstrInfo &TII,
const RISCVSubtarget &ST, MachineRegisterInfo &MRI);
bool canonicalizeWSuffixes(MachineFunction &MF, const RISCVInstrInfo &TII,
const RISCVSubtarget &ST,
MachineRegisterInfo &MRI);
+};
+
+class RISCVOptWInstrsLegacy : public MachineFunctionPass {
+public:
+ static char ID;
+
+ RISCVOptWInstrsLegacy() : MachineFunctionPass(ID) {}
+
+ bool runOnMachineFunction(MachineFunction &MF) override;
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesCFG();
@@ -83,12 +90,12 @@ class RISCVOptWInstrs : public MachineFunctionPass {
} // end anonymous namespace
-char RISCVOptWInstrs::ID = 0;
-INITIALIZE_PASS(RISCVOptWInstrs, DEBUG_TYPE, RISCV_OPT_W_INSTRS_NAME, false,
- false)
+char RISCVOptWInstrsLegacy::ID = 0;
+INITIALIZE_PASS(RISCVOptWInstrsLegacy, DEBUG_TYPE, RISCV_OPT_W_INSTRS_NAME,
+ false, false)
FunctionPass *llvm::createRISCVOptWInstrsPass() {
- return new RISCVOptWInstrs();
+ return new RISCVOptWInstrsLegacy();
}
static bool vectorPseudoHasAllNBitUsers(const MachineOperand &UserOp,
@@ -729,10 +736,10 @@ static unsigned getWOp(unsigned Opcode) {
}
}
-bool RISCVOptWInstrs::removeSExtWInstrs(MachineFunction &MF,
- const RISCVInstrInfo &TII,
- const RISCVSubtarget &ST,
- MachineRegisterInfo &MRI) {
+bool RISCVOptWInstrsImpl::removeSExtWInstrs(MachineFunction &MF,
+ const RISCVInstrInfo &TII,
+ const RISCVSubtarget &ST,
+ MachineRegisterInfo &MRI) {
if (DisableSExtWRemoval)
return false;
@@ -783,10 +790,10 @@ bool RISCVOptWInstrs::removeSExtWInstrs(MachineFunction &MF,
// Strips or adds W suffixes to eligible instructions depending on the
// subtarget preferences.
-bool RISCVOptWInstrs::canonicalizeWSuffixes(MachineFunction &MF,
- const RISCVInstrInfo &TII,
- const RISCVSubtarget &ST,
- MachineRegisterInfo &MRI) {
+bool RISCVOptWInstrsImpl::canonicalizeWSuffixes(MachineFunction &MF,
+ const RISCVInstrInfo &TII,
+ const RISCVSubtarget &ST,
+ MachineRegisterInfo &MRI) {
bool ShouldStripW = !(DisableStripWSuffix || ST.preferWInst());
bool ShouldPreferW = ST.preferWInst();
bool MadeChange = false;
@@ -877,10 +884,7 @@ bool RISCVOptWInstrs::canonicalizeWSuffixes(MachineFunction &MF,
return MadeChange;
}
-bool RISCVOptWInstrs::runOnMachineFunction(MachineFunction &MF) {
- if (skipFunction(MF.getFunction()))
- return false;
-
+bool RISCVOptWInstrsImpl::run(MachineFunction &MF) {
MachineRegisterInfo &MRI = MF.getRegInfo();
const RISCVSubtarget &ST = MF.getSubtarget<RISCVSubtarget>();
const RISCVInstrInfo &TII = *ST.getInstrInfo();
@@ -893,3 +897,21 @@ bool RISCVOptWInstrs::runOnMachineFunction(MachineFunction &MF) {
MadeChange |= canonicalizeWSuffixes(MF, TII, ST, MRI);
return MadeChange;
}
+
+bool RISCVOptWInstrsLegacy::runOnMachineFunction(MachineFunction &MF) {
+ if (skipFunction(MF.getFunction()))
+ return false;
+ return RISCVOptWInstrsImpl().run(MF);
+}
+
+PreservedAnalyses
+RISCVOptWInstrsPass::run(MachineFunction &MF,
+ MachineFunctionAnalysisManager &MFAM) {
+ bool Changed = RISCVOptWInstrsImpl().run(MF);
+ if (!Changed)
+ return PreservedAnalyses::all();
+
+ PreservedAnalyses PA = getMachineFunctionPassPreservedAnalyses();
+ PA.preserveSet<CFGAnalyses>();
+ return PA;
+}
diff --git a/llvm/lib/Target/RISCV/RISCVOptWInstrs.h b/llvm/lib/Target/RISCV/RISCVOptWInstrs.h
new file mode 100644
index 0000000000000..2919be7196705
--- /dev/null
+++ b/llvm/lib/Target/RISCV/RISCVOptWInstrs.h
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This file declares the RISC-V W-instruction optimization passes.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIB_TARGET_RISCV_RISCVOPTWINSTRS_H
+#define LLVM_LIB_TARGET_RISCV_RISCVOPTWINSTRS_H
+
+#include "llvm/CodeGen/MachinePassManager.h"
+
+namespace llvm {
+
+class FunctionPass;
+class PassRegistry;
+
+class RISCVOptWInstrsPass : public OptionalPassInfoMixin<RISCVOptWInstrsPass> {
+public:
+ PreservedAnalyses run(MachineFunction &MF,
+ MachineFunctionAnalysisManager &MFAM);
+};
+
+FunctionPass *createRISCVOptWInstrsPass();
+void initializeRISCVOptWInstrsLegacyPass(PassRegistry &);
+
+} // namespace llvm
+
+#endif // LLVM_LIB_TARGET_RISCV_RISCVOPTWINSTRS_H
diff --git a/llvm/lib/Target/RISCV/RISCVPassRegistry.def b/llvm/lib/Target/RISCV/RISCVPassRegistry.def
index 173c803646966..b62d195982ecb 100644
--- a/llvm/lib/Target/RISCV/RISCVPassRegistry.def
+++ b/llvm/lib/Target/RISCV/RISCVPassRegistry.def
@@ -35,6 +35,7 @@ FUNCTION_PASS("riscv-zacas-abi-fix", RISCVZacasABIFixPass(this))
MACHINE_FUNCTION_PASS("riscv-asm-printer", RISCVAsmPrinterPass())
MACHINE_FUNCTION_PASS("riscv-fold-mem-offset", RISCVFoldMemOffsetPass())
MACHINE_FUNCTION_PASS("riscv-isel", RISCVISelDAGToDAGPass(*this, getOptLevel()))
+MACHINE_FUNCTION_PASS("riscv-opt-w-instrs", RISCVOptWInstrsPass())
MACHINE_FUNCTION_PASS("riscv-vector-peephole", RISCVVectorPeepholePass())
MACHINE_FUNCTION_PASS("riscv-vl-optimizer", RISCVVLOptimizerPass())
#undef MACHINE_FUNCTION_PASS
diff --git a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
index 23621c02687ba..e4e66ff89c13e 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
@@ -15,6 +15,7 @@
#include "RISCV.h"
#include "RISCVMachineFunctionInfo.h"
#include "RISCVMachineScheduler.h"
+#include "RISCVOptWInstrs.h"
#include "RISCVTargetObjectFile.h"
#include "RISCVTargetTransformInfo.h"
#include "TargetInfo/RISCVTargetInfo.h"
@@ -132,7 +133,7 @@ extern "C" LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializeRISCVTarget() {
initializeRISCVZacasABIFixLegacyPass(*PR);
initializeRISCVPostRAExpandPseudoPass(*PR);
initializeRISCVMergeBaseOffsetOptPass(*PR);
- initializeRISCVOptWInstrsPass(*PR);
+ initializeRISCVOptWInstrsLegacyPass(*PR);
initializeRISCVFoldMemOffsetLegacyPass(*PR);
initializeRISCVPreRAExpandPseudoPass(*PR);
initializeRISCVExpandPseudoPass(*PR);
diff --git a/llvm/test/CodeGen/RISCV/O1-newpm-pipeline.ll b/llvm/test/CodeGen/RISCV/O1-newpm-pipeline.ll
index d25902948a166..eb054e64e32ff 100644
--- a/llvm/test/CodeGen/RISCV/O1-newpm-pipeline.ll
+++ b/llvm/test/CodeGen/RISCV/O1-newpm-pipeline.ll
@@ -1,7 +1,7 @@
; RUN: llc -enable-new-pm -mtriple=riscv32 -O1 -print-pipeline-passes=tree < %s 2>&1 \
; RUN: | FileCheck %s
; RUN: llc -enable-new-pm -mtriple=riscv64 -O1 -print-pipeline-passes=tree < %s 2>&1 \
-; RUN: | FileCheck %s
+; RUN: | FileCheck %s --check-prefixes=CHECK,RV64
; CHECK: require<MachineModuleAnalysis>
; CHECK-NEXT: require<profile-summary>
@@ -59,6 +59,7 @@
; CHECK-NEXT: machine-sink
; CHECK-NEXT: peephole-opt
; CHECK-NEXT: dead-mi-elimination
+; RV64-NEXT: riscv-opt-w-instrs
; CHECK-NEXT: detect-dead-lanes
; CHECK-NEXT: init-undef
; CHECK-NEXT: process-imp-defs
diff --git a/llvm/test/CodeGen/RISCV/O3-newpm-pipeline.ll b/llvm/test/CodeGen/RISCV/O3-newpm-pipeline.ll
index 45ce42dd1fb67..593912c130e19 100644
--- a/llvm/test/CodeGen/RISCV/O3-newpm-pipeline.ll
+++ b/llvm/test/CodeGen/RISCV/O3-newpm-pipeline.ll
@@ -1,7 +1,7 @@
; RUN: llc -enable-new-pm -mtriple=riscv32 -O3 -print-pipeline-passes=tree < %s 2>&1 \
; RUN: | FileCheck %s
; RUN: llc -enable-new-pm -mtriple=riscv64 -O3 -print-pipeline-passes=tree < %s 2>&1 \
-; RUN: | FileCheck %s
+; RUN: | FileCheck %s --check-prefixes=CHECK,RV64
; CHECK: require<MachineModuleAnalysis>
; CHECK-NEXT: require<profile-summary>
@@ -59,6 +59,7 @@
; CHECK-NEXT: machine-sink
; CHECK-NEXT: peephole-opt
; CHECK-NEXT: dead-mi-elimination
+; RV64-NEXT: riscv-opt-w-instrs
; CHECK-NEXT: detect-dead-lanes
; CHECK-NEXT: init-undef
; CHECK-NEXT: process-imp-defs
diff --git a/llvm/test/CodeGen/RISCV/opt-w-instrs-p-ext.mir b/llvm/test/CodeGen/RISCV/opt-w-instrs-p-ext.mir
index 55545fab298d8..4253494456854 100644
--- a/llvm/test/CodeGen/RISCV/opt-w-instrs-p-ext.mir
+++ b/llvm/test/CodeGen/RISCV/opt-w-instrs-p-ext.mir
@@ -1,5 +1,6 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 3
# RUN: llc -mtriple=riscv64 -mattr=+experimental-p -verify-machineinstrs -run-pass=riscv-opt-w-instrs %s -o - | FileCheck %s
+# RUN: llc -mtriple=riscv64 -mattr=+experimental-p -verify-machineinstrs -passes=riscv-opt-w-instrs %s -o - | FileCheck %s
---
name: merge_sextw_removed
diff --git a/llvm/test/CodeGen/RISCV/opt-w-instrs.mir b/llvm/test/CodeGen/RISCV/opt-w-instrs.mir
index 7aef3cb662fe7..879c7b5317eaa 100644
--- a/llvm/test/CodeGen/RISCV/opt-w-instrs.mir
+++ b/llvm/test/CodeGen/RISCV/opt-w-instrs.mir
@@ -1,5 +1,6 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 3
# RUN: llc -mtriple=riscv64 -mattr='+d,+zfa,+v,+xtheadmempair' -verify-machineinstrs -run-pass=riscv-opt-w-instrs %s -o - | FileCheck %s
+# RUN: llc -mtriple=riscv64 -mattr='+d,+zfa,+v,+xtheadmempair' -verify-machineinstrs -passes=riscv-opt-w-instrs %s -o - | FileCheck %s
---
name: fcvtmod_w_d
diff --git a/llvm/test/CodeGen/RISCV/prefer-w-inst.mir b/llvm/test/CodeGen/RISCV/prefer-w-inst.mir
index f534567c1f12e..4dc479f5d9075 100644
--- a/llvm/test/CodeGen/RISCV/prefer-w-inst.mir
+++ b/llvm/test/CodeGen/RISCV/prefer-w-inst.mir
@@ -1,8 +1,12 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4
# RUN: llc %s -mtriple=riscv64 -run-pass=riscv-opt-w-instrs -verify-machineinstrs \
# RUN: -mattr=+m -o - | FileCheck %s -check-prefixes=NO-PREFER-W-INST
+# RUN: llc %s -mtriple=riscv64 -passes=riscv-opt-w-instrs -verify-machineinstrs \
+# RUN: -mattr=+m -o - | FileCheck %s -check-prefixes=NO-PREFER-W-INST
# RUN: llc %s -mtriple=riscv64 -run-pass=riscv-opt-w-instrs -verify-machineinstrs \
# RUN: -mattr=+m,+prefer-w-inst -o - | FileCheck %s -check-prefixes=PREFER-W-INST
+# RUN: llc %s -mtriple=riscv64 -passes=riscv-opt-w-instrs -verify-machineinstrs \
+# RUN: -mattr=+m,+prefer-w-inst -o - | FileCheck %s -check-prefixes=PREFER-W-INST
---
name: addi
diff --git a/llvm/test/CodeGen/RISCV/sextw-removal-debug.mir b/llvm/test/CodeGen/RISCV/sextw-removal-debug.mir
index f247c5f38037b..2aae5f0a8348e 100644
--- a/llvm/test/CodeGen/RISCV/sextw-removal-debug.mir
+++ b/llvm/test/CodeGen/RISCV/sextw-removal-debug.mir
@@ -1,5 +1,6 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4
# RUN: llc %s -mtriple=riscv64 -run-pass=riscv-opt-w-instrs -o - | FileCheck %s
+# RUN: llc %s -mtriple=riscv64 -passes=riscv-opt-w-instrs -o - | FileCheck %s
--- |
define void @foo(i32 signext %a, i32 signext %b, ptr %c) !dbg !5 {
diff --git a/llvm/test/CodeGen/RISCV/zilx-opt-w-instrs.mir b/llvm/test/CodeGen/RISCV/zilx-opt-w-instrs.mir
index b620a5371d74d..32636d964d392 100644
--- a/llvm/test/CodeGen/RISCV/zilx-opt-w-instrs.mir
+++ b/llvm/test/CodeGen/RISCV/zilx-opt-w-instrs.mir
@@ -1,5 +1,6 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 3
# RUN: llc -mtriple=riscv64 -mattr=+experimental-zilx -verify-machineinstrs -run-pass=riscv-opt-w-instrs %s -o - | FileCheck %s
+# RUN: llc -mtriple=riscv64 -mattr=+experimental-zilx -verify-machineinstrs -passes=riscv-opt-w-instrs %s -o - | FileCheck %s
# The Zilx doubleword/unsigned-word indexed loads participate in the W-suffix
# canonicalization the same way LD/LWU do: LXD and LXWU can be narrowed to LXW
>From f66c70c85182ae9f9c156eee6a86cb8400fc8878 Mon Sep 17 00:00:00 2001
From: Sam Elliott <aelliott at qti.qualcomm.com>
Date: Wed, 19 Aug 2026 23:41:21 -0700
Subject: [PATCH 2/2] Header to RISCV.h, rename to
createRISCVOptWInstrsLegacyPass
---
llvm/lib/Target/RISCV/RISCV.h | 10 ++++--
llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp | 4 +--
llvm/lib/Target/RISCV/RISCVOptWInstrs.h | 35 --------------------
llvm/lib/Target/RISCV/RISCVTargetMachine.cpp | 3 +-
4 files changed, 11 insertions(+), 41 deletions(-)
delete mode 100644 llvm/lib/Target/RISCV/RISCVOptWInstrs.h
diff --git a/llvm/lib/Target/RISCV/RISCV.h b/llvm/lib/Target/RISCV/RISCV.h
index 356dc442d9878..504c268a57ffb 100644
--- a/llvm/lib/Target/RISCV/RISCV.h
+++ b/llvm/lib/Target/RISCV/RISCV.h
@@ -88,8 +88,14 @@ class RISCVVectorPeepholePass
FunctionPass *createRISCVVectorPeepholeLegacyPass();
void initializeRISCVVectorPeepholeLegacyPass(PassRegistry &);
-FunctionPass *createRISCVOptWInstrsPass();
-void initializeRISCVOptWInstrsPass(PassRegistry &);
+class RISCVOptWInstrsPass : public OptionalPassInfoMixin<RISCVOptWInstrsPass> {
+public:
+ PreservedAnalyses run(MachineFunction &MF,
+ MachineFunctionAnalysisManager &MFAM);
+};
+
+FunctionPass *createRISCVOptWInstrsLegacyPass();
+void initializeRISCVOptWInstrsLegacyPass(PassRegistry &);
class RISCVFoldMemOffsetPass
: public OptionalPassInfoMixin<RISCVFoldMemOffsetPass> {
diff --git a/llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp b/llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp
index 335316941b020..08d72f28b9e0b 100644
--- a/llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp
+++ b/llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp
@@ -32,7 +32,7 @@
// * ld/lwu.
//===---------------------------------------------------------------------===//
-#include "RISCVOptWInstrs.h"
+#include "RISCV.h"
#include "RISCVMachineFunctionInfo.h"
#include "RISCVSubtarget.h"
#include "llvm/ADT/SmallSet.h"
@@ -94,7 +94,7 @@ char RISCVOptWInstrsLegacy::ID = 0;
INITIALIZE_PASS(RISCVOptWInstrsLegacy, DEBUG_TYPE, RISCV_OPT_W_INSTRS_NAME,
false, false)
-FunctionPass *llvm::createRISCVOptWInstrsPass() {
+FunctionPass *llvm::createRISCVOptWInstrsLegacyPass() {
return new RISCVOptWInstrsLegacy();
}
diff --git a/llvm/lib/Target/RISCV/RISCVOptWInstrs.h b/llvm/lib/Target/RISCV/RISCVOptWInstrs.h
deleted file mode 100644
index 2919be7196705..0000000000000
--- a/llvm/lib/Target/RISCV/RISCVOptWInstrs.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-///
-/// \file
-/// This file declares the RISC-V W-instruction optimization passes.
-///
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIB_TARGET_RISCV_RISCVOPTWINSTRS_H
-#define LLVM_LIB_TARGET_RISCV_RISCVOPTWINSTRS_H
-
-#include "llvm/CodeGen/MachinePassManager.h"
-
-namespace llvm {
-
-class FunctionPass;
-class PassRegistry;
-
-class RISCVOptWInstrsPass : public OptionalPassInfoMixin<RISCVOptWInstrsPass> {
-public:
- PreservedAnalyses run(MachineFunction &MF,
- MachineFunctionAnalysisManager &MFAM);
-};
-
-FunctionPass *createRISCVOptWInstrsPass();
-void initializeRISCVOptWInstrsLegacyPass(PassRegistry &);
-
-} // namespace llvm
-
-#endif // LLVM_LIB_TARGET_RISCV_RISCVOPTWINSTRS_H
diff --git a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
index e4e66ff89c13e..5d891fcd998cc 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
@@ -15,7 +15,6 @@
#include "RISCV.h"
#include "RISCVMachineFunctionInfo.h"
#include "RISCVMachineScheduler.h"
-#include "RISCVOptWInstrs.h"
#include "RISCVTargetObjectFile.h"
#include "RISCVTargetTransformInfo.h"
#include "TargetInfo/RISCVTargetInfo.h"
@@ -631,7 +630,7 @@ void RISCVPassConfig::addMachineSSAOptimization() {
TargetPassConfig::addMachineSSAOptimization();
if (TM->getTargetTriple().isRISCV64()) {
- addPass(createRISCVOptWInstrsPass());
+ addPass(createRISCVOptWInstrsLegacyPass());
}
}
More information about the llvm-branch-commits
mailing list