[llvm] 2c70c50 - [RISCV] Cleanup RISCVGatherScatterLoweringPass (#217762)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 15:59:34 PDT 2026


Author: Aiden Grossman
Date: 2026-08-20T15:59:29-07:00
New Revision: 2c70c5075bcac54416b39069566a51d3c806be1b

URL: https://github.com/llvm/llvm-project/commit/2c70c5075bcac54416b39069566a51d3c806be1b
DIFF: https://github.com/llvm/llvm-project/commit/2c70c5075bcac54416b39069566a51d3c806be1b.diff

LOG: [RISCV] Cleanup RISCVGatherScatterLoweringPass (#217762)

Rename the createPass function to have a legacy suffix, and also move
the class definition for the NewPM version into RISCV.h to be consistent
with other passes.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCV.h
    llvm/lib/Target/RISCV/RISCVCodeGenPassBuilder.cpp
    llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
    llvm/lib/Target/RISCV/RISCVTargetMachine.cpp

Removed: 
    llvm/lib/Target/RISCV/RISCVGatherScatterLowering.h


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCV.h b/llvm/lib/Target/RISCV/RISCV.h
index db0381ba362df..e2a516ec86597 100644
--- a/llvm/lib/Target/RISCV/RISCV.h
+++ b/llvm/lib/Target/RISCV/RISCV.h
@@ -62,6 +62,19 @@ void initializeRISCVLateBranchOptPass(PassRegistry &);
 FunctionPass *createRISCVMakeCompressibleOptPass();
 void initializeRISCVMakeCompressibleOptPass(PassRegistry &);
 
+class RISCVGatherScatterLoweringPass
+    : public OptionalPassInfoMixin<RISCVGatherScatterLoweringPass> {
+private:
+  const RISCVTargetMachine *TM;
+
+public:
+  RISCVGatherScatterLoweringPass(const RISCVTargetMachine *TM) : TM(TM) {}
+  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+};
+
+FunctionPass *createRISCVGatherScatterLoweringLegacyPass();
+void initializeRISCVGatherScatterLoweringLegacyPass(PassRegistry &);
+
 FunctionPass *createRISCVVectorPeepholePass();
 void initializeRISCVVectorPeepholePass(PassRegistry &);
 

diff  --git a/llvm/lib/Target/RISCV/RISCVCodeGenPassBuilder.cpp b/llvm/lib/Target/RISCV/RISCVCodeGenPassBuilder.cpp
index ca72edccfb66a..5578bc59450e7 100644
--- a/llvm/lib/Target/RISCV/RISCVCodeGenPassBuilder.cpp
+++ b/llvm/lib/Target/RISCV/RISCVCodeGenPassBuilder.cpp
@@ -11,7 +11,6 @@
 
 #include "RISCV.h"
 #include "RISCVAsmPrinter.h"
-#include "RISCVGatherScatterLowering.h"
 #include "RISCVTargetMachine.h"
 #include "llvm/CodeGen/AtomicExpand.h"
 #include "llvm/CodeGen/BranchRelaxation.h"

diff  --git a/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp b/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
index c1dff38e3d0a1..a52b01b2279df 100644
--- a/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
@@ -11,7 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "RISCVGatherScatterLowering.h"
+#include "RISCV.h"
 #include "RISCVTargetMachine.h"
 #include "llvm/Analysis/InstSimplifyFolder.h"
 #include "llvm/Analysis/LoopInfo.h"
@@ -97,7 +97,7 @@ INITIALIZE_PASS_DEPENDENCY(TargetPassConfig)
 INITIALIZE_PASS_END(RISCVGatherScatterLoweringLegacy, DEBUG_TYPE,
                     "RISC-V gather/scatter lowering pass", false, false)
 
-FunctionPass *llvm::createRISCVGatherScatterLoweringPass() {
+FunctionPass *llvm::createRISCVGatherScatterLoweringLegacyPass() {
   return new RISCVGatherScatterLoweringLegacy();
 }
 

diff  --git a/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.h b/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.h
deleted file mode 100644
index 886f3b8217457..0000000000000
--- a/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.h
+++ /dev/null
@@ -1,40 +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 gather/scatter lowering passes.
-///
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIB_TARGET_RISCV_RISCVGATHERSCATTERLOWERING_H
-#define LLVM_LIB_TARGET_RISCV_RISCVGATHERSCATTERLOWERING_H
-
-#include "llvm/IR/PassManager.h"
-
-namespace llvm {
-
-class FunctionPass;
-class PassRegistry;
-class RISCVTargetMachine;
-
-class RISCVGatherScatterLoweringPass
-    : public OptionalPassInfoMixin<RISCVGatherScatterLoweringPass> {
-private:
-  const RISCVTargetMachine *TM;
-
-public:
-  RISCVGatherScatterLoweringPass(const RISCVTargetMachine *TM) : TM(TM) {}
-  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
-};
-
-FunctionPass *createRISCVGatherScatterLoweringPass();
-void initializeRISCVGatherScatterLoweringLegacyPass(PassRegistry &);
-
-} // namespace llvm
-
-#endif // LLVM_LIB_TARGET_RISCV_RISCVGATHERSCATTERLOWERING_H

diff  --git a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
index 0642b90638f0f..06763f8919180 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
@@ -13,7 +13,6 @@
 #include "RISCVTargetMachine.h"
 #include "MCTargetDesc/RISCVBaseInfo.h"
 #include "RISCV.h"
-#include "RISCVGatherScatterLowering.h"
 #include "RISCVMachineFunctionInfo.h"
 #include "RISCVMachineScheduler.h"
 #include "RISCVTargetObjectFile.h"
@@ -474,7 +473,7 @@ void RISCVPassConfig::addIRPasses() {
     if (EnableLoopDataPrefetch)
       addPass(createLoopDataPrefetchPass());
 
-    addPass(createRISCVGatherScatterLoweringPass());
+    addPass(createRISCVGatherScatterLoweringLegacyPass());
     addPass(createInterleavedAccessPass());
     addPass(createRISCVCodeGenPrepareLegacyPass());
   }


        


More information about the llvm-commits mailing list