[llvm] [RISCV][NewPM] Port RISCVCodeGenPrepare to the new pass manager (PR #168381)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 17 09:26:56 PST 2025


================
@@ -33,36 +33,42 @@ using namespace llvm;
 #define PASS_NAME "RISC-V CodeGenPrepare"
 
 namespace {
-
-class RISCVCodeGenPrepare : public FunctionPass,
-                            public InstVisitor<RISCVCodeGenPrepare, bool> {
+class RISCVCodeGenPrepare : public InstVisitor<RISCVCodeGenPrepare, bool> {
+  Function &F;
   const DataLayout *DL;
   const DominatorTree *DT;
   const RISCVSubtarget *ST;
 
+public:
+  RISCVCodeGenPrepare(Function &F, const DominatorTree *DT,
+                      const RISCVSubtarget *ST)
+      : F(F), DL(&F.getDataLayout()), DT(DT), ST(ST) {}
+  bool run();
+  bool visitInstruction(Instruction &I) { return false; }
+  bool visitAnd(BinaryOperator &BO);
+  bool visitIntrinsicInst(IntrinsicInst &I);
+  bool expandVPStrideLoad(IntrinsicInst &I);
+  bool widenVPMerge(IntrinsicInst &I);
+};
+} // namespace
+
+namespace {
+class RISCVCodeGenPrepareLegacyPass : public FunctionPass {
----------------
topperc wrote:

Can we just drop Pass from the end of the name to fix the "PassPass" issue?

There are other examples like
`SelectionDAGISelLegacy`, `LiveDebugVariablesWrapperLegacy`, `LiveStacksWrapperLegacy`, `DXILDataScalarizationLegacy`, `DXILFinalizeLinkageLegacy`, `DXILLegalizeLegacy`

https://github.com/llvm/llvm-project/pull/168381


More information about the llvm-commits mailing list