Skip to content

[mlir] Retire additional let constructor (NFC) #139390

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 1 commit into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions mlir/include/mlir/Dialect/Arith/Transforms/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ void populateExpandBFloat16Patterns(RewritePatternSet &patterns);
/// Add patterns to expand Arith ops.
void populateArithExpandOpsPatterns(RewritePatternSet &patterns);

/// Create a pass to replace signed ops with unsigned ones where they are proven
/// equivalent.
std::unique_ptr<Pass> createArithUnsignedWhenEquivalentPass();

/// Add patterns for int range based optimizations.
void populateIntRangeOptimizationsPatterns(RewritePatternSet &patterns,
DataFlowSolver &solver);
Expand Down
3 changes: 1 addition & 2 deletions mlir/include/mlir/Dialect/Arith/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def ArithExpandOpsPass : Pass<"arith-expand"> {
];
}

def ArithUnsignedWhenEquivalent : Pass<"arith-unsigned-when-equivalent"> {
def ArithUnsignedWhenEquivalentPass : Pass<"arith-unsigned-when-equivalent"> {
let summary = "Replace signed ops with unsigned ones where they are proven equivalent";
let description = [{
Replace signed ops with their unsigned equivalents when integer range analysis
Expand All @@ -33,7 +33,6 @@ def ArithUnsignedWhenEquivalent : Pass<"arith-unsigned-when-equivalent"> {
The affect ops include division, remainder, shifts, min, max, and integer
comparisons.
}];
let constructor = "mlir::arith::createArithUnsignedWhenEquivalentPass()";
}

def ArithIntRangeOpts : Pass<"int-range-optimizations"> {
Expand Down
5 changes: 1 addition & 4 deletions mlir/include/mlir/Dialect/Func/Transforms/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@ class RewritePatternSet;

namespace func {

#define GEN_PASS_DECL
#define GEN_PASS_DECL_DUPLICATEFUNCTIONELIMINATIONPASS
#include "mlir/Dialect/Func/Transforms/Passes.h.inc"

/// Pass to deduplicate functions.
std::unique_ptr<Pass> createDuplicateFunctionEliminationPass();

//===----------------------------------------------------------------------===//
// Registration
//===----------------------------------------------------------------------===//
Expand Down
1 change: 0 additions & 1 deletion mlir/include/mlir/Dialect/Func/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def DuplicateFunctionEliminationPass : Pass<"duplicate-function-elimination",
name. The pass chooses one representative per equivalence class, erases
the remainder, and updates function calls accordingly.
}];
let constructor = "mlir::func::createDuplicateFunctionEliminationPass()";
}

#endif // MLIR_DIALECT_FUNC_TRANSFORMS_PASSES_TD
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Pass;

namespace LLVM {

#define GEN_PASS_DECL_LLVMLEGALIZEFOREXPORT
#define GEN_PASS_DECL_LLVMLEGALIZEFOREXPORTPASS
#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"

/// Make argument-taking successors of each block distinct. PHI nodes in LLVM
Expand All @@ -27,10 +27,6 @@ namespace LLVM {
/// a new dummy block for LLVM PHI nodes to tell the sources apart.
void ensureDistinctSuccessors(Operation *op);

/// Creates a pass that legalizes the LLVM dialect operations so that they can
/// be translated to LLVM IR.
std::unique_ptr<Pass> createLegalizeForExportPass();

} // namespace LLVM
} // namespace mlir

Expand Down
12 changes: 3 additions & 9 deletions mlir/include/mlir/Dialect/LLVMIR/Transforms/OptimizeForNVVM.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,10 @@

namespace mlir {
class Pass;

namespace NVVM {

#define GEN_PASS_DECL_NVVMOPTIMIZEFORTARGET
namespace LLVM {
#define GEN_PASS_DECL_NVVMOPTIMIZEFORTARGETPASS
#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"

/// Creates a pass that optimizes LLVM IR for the NVVM target.
std::unique_ptr<Pass> createOptimizeForTargetPass();

} // namespace NVVM
} // namespace LLVM
} // namespace mlir

#endif // MLIR_DIALECT_LLVMIR_TRANSFORMS_OPTIMIZENVVM_H
13 changes: 7 additions & 6 deletions mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ def LLVMAddComdats : Pass<"llvm-add-comdats", "::mlir::ModuleOp"> {
}];
}

def LLVMLegalizeForExport : Pass<"llvm-legalize-for-export"> {
def LLVMLegalizeForExportPass : Pass<"llvm-legalize-for-export"> {
let summary = "Legalize LLVM dialect to be convertible to LLVM IR";
let constructor = "::mlir::LLVM::createLegalizeForExportPass()";
let description = [{
Creates a pass that legalizes the LLVM dialect operations so that they can
be translated to LLVM IR.
}];
let dependentDialects = ["LLVM::LLVMDialect"];
}

def LLVMRequestCWrappers
def LLVMRequestCWrappersPass
: Pass<"llvm-request-c-wrappers", "::mlir::func::FuncOp"> {
let summary = "Request C wrapper emission for all functions";
let description = [{
Expand All @@ -40,12 +43,10 @@ def LLVMRequestCWrappers
conversion of builtin functions to LLVM to avoid the attribute being
dropped by other passes.
}];
let constructor = "::mlir::LLVM::createRequestCWrappersPass()";
}

def NVVMOptimizeForTarget : Pass<"llvm-optimize-for-nvvm-target"> {
def NVVMOptimizeForTargetPass : Pass<"llvm-optimize-for-nvvm-target"> {
let summary = "Optimize NVVM IR";
let constructor = "::mlir::NVVM::createOptimizeForTargetPass()";
}

def DIScopeForLLVMFuncOpPass : Pass<"ensure-debug-info-scope-on-llvm-func", "::mlir::ModuleOp"> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ class Pass;

namespace LLVM {

#define GEN_PASS_DECL_LLVMREQUESTCWRAPPERS
#define GEN_PASS_DECL_LLVMREQUESTCWRAPPERSPASS
#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"

std::unique_ptr<Pass> createRequestCWrappersPass();
} // namespace LLVM
} // namespace mlir

Expand Down
3 changes: 2 additions & 1 deletion mlir/include/mlir/Dialect/Tensor/Transforms/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ namespace tensor {
//===----------------------------------------------------------------------===//

/// Creates an instance of the `tensor` subset folding pass.
std::unique_ptr<Pass> createFoldTensorSubsetOpsPass();
#define GEN_PASS_DECL_FOLDTENSORSUBSETOPSPASS
#include "mlir/Dialect/Tensor/Transforms/Passes.h.inc"

//===----------------------------------------------------------------------===//
// Registration
Expand Down
3 changes: 1 addition & 2 deletions mlir/include/mlir/Dialect/Tensor/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

include "mlir/Pass/PassBase.td"

def FoldTensorSubsetOps : Pass<"fold-tensor-subset-ops"> {
def FoldTensorSubsetOpsPass : Pass<"fold-tensor-subset-ops"> {
let summary = "Fold tensor subset ops into producer/consumer ops";
let description = [{
The pass folds tensor subset ops into producer/consumer ops.
Expand All @@ -21,7 +21,6 @@ def FoldTensorSubsetOps : Pass<"fold-tensor-subset-ops"> {
- vector.transfer_write into tensor.insert_slice

}];
let constructor = "mlir::tensor::createFoldTensorSubsetOpsPass()";
let dependentDialects = [
"affine::AffineDialect", "tensor::TensorDialect", "vector::VectorDialect"
];
Expand Down
8 changes: 2 additions & 6 deletions mlir/lib/Dialect/Arith/Transforms/UnsignedWhenEquivalent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace mlir {
namespace arith {
#define GEN_PASS_DEF_ARITHUNSIGNEDWHENEQUIVALENT
#define GEN_PASS_DEF_ARITHUNSIGNEDWHENEQUIVALENTPASS
#include "mlir/Dialect/Arith/Transforms/Passes.h.inc"
} // namespace arith
} // namespace mlir
Expand Down Expand Up @@ -118,7 +118,7 @@ struct ConvertCmpIToUnsigned final : OpRewritePattern<CmpIOp> {
};

struct ArithUnsignedWhenEquivalentPass
: public arith::impl::ArithUnsignedWhenEquivalentBase<
: public arith::impl::ArithUnsignedWhenEquivalentPassBase<
ArithUnsignedWhenEquivalentPass> {

void runOnOperation() override {
Expand Down Expand Up @@ -151,7 +151,3 @@ void mlir::arith::populateUnsignedWhenEquivalentPatterns(
ConvertOpToUnsigned<ExtSIOp, ExtUIOp>, ConvertCmpIToUnsigned>(
patterns.getContext(), solver);
}

std::unique_ptr<Pass> mlir::arith::createArithUnsignedWhenEquivalentPass() {
return std::make_unique<ArithUnsignedWhenEquivalentPass>();
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
#include "mlir/Dialect/Func/Transforms/Passes.h"

namespace mlir {
namespace {

namespace func {
#define GEN_PASS_DEF_DUPLICATEFUNCTIONELIMINATIONPASS
#include "mlir/Dialect/Func/Transforms/Passes.h.inc"
} // namespace func

namespace {

// Define a notion of function equivalence that allows for reuse. Ignore the
// symbol name for this purpose.
Expand Down Expand Up @@ -80,7 +82,7 @@ struct DuplicateFuncOpEquivalenceInfo
};

struct DuplicateFunctionEliminationPass
: public impl::DuplicateFunctionEliminationPassBase<
: public func::impl::DuplicateFunctionEliminationPassBase<
DuplicateFunctionEliminationPass> {

using DuplicateFunctionEliminationPassBase<
Expand Down Expand Up @@ -115,9 +117,4 @@ struct DuplicateFunctionEliminationPass
};

} // namespace

std::unique_ptr<Pass> mlir::func::createDuplicateFunctionEliminationPass() {
return std::make_unique<DuplicateFunctionEliminationPass>();
}

} // namespace mlir
8 changes: 2 additions & 6 deletions mlir/lib/Dialect/LLVMIR/Transforms/LegalizeForExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace mlir {
namespace LLVM {
#define GEN_PASS_DEF_LLVMLEGALIZEFOREXPORT
#define GEN_PASS_DEF_LLVMLEGALIZEFOREXPORTPASS
#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
} // namespace LLVM
} // namespace mlir
Expand Down Expand Up @@ -77,14 +77,10 @@ void mlir::LLVM::ensureDistinctSuccessors(Operation *op) {

namespace {
struct LegalizeForExportPass
: public LLVM::impl::LLVMLegalizeForExportBase<LegalizeForExportPass> {
: public LLVM::impl::LLVMLegalizeForExportPassBase<LegalizeForExportPass> {
void runOnOperation() override {
LLVM::ensureDistinctSuccessors(getOperation());
LLVM::legalizeDIExpressionsRecursively(getOperation());
}
};
} // namespace

std::unique_ptr<Pass> LLVM::createLegalizeForExportPass() {
return std::make_unique<LegalizeForExportPass>();
}
12 changes: 4 additions & 8 deletions mlir/lib/Dialect/LLVMIR/Transforms/OptimizeForNVVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"

namespace mlir {
namespace NVVM {
#define GEN_PASS_DEF_NVVMOPTIMIZEFORTARGET
namespace LLVM {
#define GEN_PASS_DEF_NVVMOPTIMIZEFORTARGETPASS
#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
} // namespace NVVM
} // namespace LLVM
} // namespace mlir

using namespace mlir;
Expand All @@ -40,7 +40,7 @@ struct ExpandDivF16 : public OpRewritePattern<LLVM::FDivOp> {
};

struct NVVMOptimizeForTarget
: public NVVM::impl::NVVMOptimizeForTargetBase<NVVMOptimizeForTarget> {
: public LLVM::impl::NVVMOptimizeForTargetPassBase<NVVMOptimizeForTarget> {
void runOnOperation() override;

void getDependentDialects(DialectRegistry &registry) const override {
Expand Down Expand Up @@ -99,7 +99,3 @@ void NVVMOptimizeForTarget::runOnOperation() {
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns))))
return signalPassFailure();
}

std::unique_ptr<Pass> NVVM::createOptimizeForTargetPass() {
return std::make_unique<NVVMOptimizeForTarget>();
}
8 changes: 2 additions & 6 deletions mlir/lib/Dialect/LLVMIR/Transforms/RequestCWrappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace mlir {
namespace LLVM {
#define GEN_PASS_DEF_LLVMREQUESTCWRAPPERS
#define GEN_PASS_DEF_LLVMREQUESTCWRAPPERSPASS
#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
} // namespace LLVM
} // namespace mlir
Expand All @@ -22,15 +22,11 @@ using namespace mlir;

namespace {
class RequestCWrappersPass
: public LLVM::impl::LLVMRequestCWrappersBase<RequestCWrappersPass> {
: public LLVM::impl::LLVMRequestCWrappersPassBase<RequestCWrappersPass> {
public:
void runOnOperation() override {
getOperation()->setAttr(LLVM::LLVMDialect::getEmitCWrapperAttrName(),
UnitAttr::get(&getContext()));
}
};
} // namespace

std::unique_ptr<Pass> mlir::LLVM::createRequestCWrappersPass() {
return std::make_unique<RequestCWrappersPass>();
}
9 changes: 3 additions & 6 deletions mlir/lib/Dialect/Tensor/Transforms/FoldTensorSubsetOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

namespace mlir {
namespace tensor {
#define GEN_PASS_DEF_FOLDTENSORSUBSETOPS
#define GEN_PASS_DEF_FOLDTENSORSUBSETOPSPASS
#include "mlir/Dialect/Tensor/Transforms/Passes.h.inc"
} // namespace tensor
} // namespace mlir
Expand Down Expand Up @@ -268,7 +268,8 @@ void tensor::populateFoldTensorSubsetIntoVectorTransferPatterns(
namespace {

struct FoldTensorSubsetOpsPass final
: public tensor::impl::FoldTensorSubsetOpsBase<FoldTensorSubsetOpsPass> {
: public tensor::impl::FoldTensorSubsetOpsPassBase<
FoldTensorSubsetOpsPass> {
void runOnOperation() override;
};

Expand All @@ -279,7 +280,3 @@ void FoldTensorSubsetOpsPass::runOnOperation() {
tensor::populateFoldTensorSubsetOpPatterns(patterns);
(void)applyPatternsGreedily(getOperation(), std::move(patterns));
}

std::unique_ptr<Pass> tensor::createFoldTensorSubsetOpsPass() {
return std::make_unique<FoldTensorSubsetOpsPass>();
}
3 changes: 2 additions & 1 deletion mlir/test/lib/Pass/TestVulkanRunnerPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ void buildTestVulkanRunnerPipeline(OpPassManager &passManager,
passManager.addPass(createGpuModuleToBinaryPass());

passManager.addPass(createFinalizeMemRefToLLVMConversionPass());
passManager.nest<func::FuncOp>().addPass(LLVM::createRequestCWrappersPass());
passManager.nest<func::FuncOp>().addPass(
LLVM::createLLVMRequestCWrappersPass());
// VulkanRuntimeWrappers.cpp requires these calling convention options.
GpuToLLVMConversionPassOptions opt;
opt.hostBarePtrCallConv = false;
Expand Down