[Mlir-commits] [mlir] d124b98 - [mlir] add overload `createDIScopeForLLVMFuncOp` function (#111689)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Oct 10 02:11:19 PDT 2024
Author: Observer007
Date: 2024-10-10T17:11:14+08:00
New Revision: d124b98eb6d492ce306dd28ecace326fb38457c5
URL: https://github.com/llvm/llvm-project/commit/d124b98eb6d492ce306dd28ecace326fb38457c5
DIFF: https://github.com/llvm/llvm-project/commit/d124b98eb6d492ce306dd28ecace326fb38457c5.diff
LOG: [mlir] add overload `createDIScopeForLLVMFuncOp` function (#111689)
follow up work of https://github.com/llvm/llvm-project/pull/106229, add
create pass overload function to create pass.
---------
Co-authored-by: jingzec <jingzec at nvidia.com>
Added:
Modified:
mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h
mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
mlir/lib/Dialect/LLVMIR/Transforms/DIScopeForLLVMFuncOp.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h b/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h
index 078c7d12f6f22b..c598ffe3602dc1 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h
@@ -20,9 +20,6 @@ namespace mlir {
namespace LLVM {
-/// Create a pass to add DIScope to LLVMFuncOp that are missing it.
-std::unique_ptr<Pass> createDIScopeForLLVMFuncOpPass();
-
/// Generate the code for registering conversion passes.
#define GEN_PASS_DECL
#define GEN_PASS_REGISTRATION
diff --git a/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td b/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
index d54bc55c9edaab..b2a03ce61e7e48 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
@@ -48,7 +48,7 @@ def NVVMOptimizeForTarget : Pass<"llvm-optimize-for-nvvm-target"> {
let constructor = "::mlir::NVVM::createOptimizeForTargetPass()";
}
-def DIScopeForLLVMFuncOp : Pass<"ensure-debug-info-scope-on-llvm-func", "::mlir::ModuleOp"> {
+def DIScopeForLLVMFuncOpPass : Pass<"ensure-debug-info-scope-on-llvm-func", "::mlir::ModuleOp"> {
let summary = "Materialize LLVM debug info subprogram attribute on every LLVMFuncOp";
let description = [{
Having a debug info subprogram attribute on a function is required for
@@ -60,7 +60,6 @@ def DIScopeForLLVMFuncOp : Pass<"ensure-debug-info-scope-on-llvm-func", "::mlir:
line-by-line or get a backtrace with line numbers.
}];
- let constructor = "mlir::LLVM::createDIScopeForLLVMFuncOpPass()";
let options = [
Option<"emissionKind", "emission-kind", "mlir::LLVM::DIEmissionKind",
/*default=*/"mlir::LLVM::DIEmissionKind::LineTablesOnly", "Emission kind to generate debug info.",
diff --git a/mlir/lib/Dialect/LLVMIR/Transforms/DIScopeForLLVMFuncOp.cpp b/mlir/lib/Dialect/LLVMIR/Transforms/DIScopeForLLVMFuncOp.cpp
index 052e98ea8b8d48..6db14ea5bbfd44 100644
--- a/mlir/lib/Dialect/LLVMIR/Transforms/DIScopeForLLVMFuncOp.cpp
+++ b/mlir/lib/Dialect/LLVMIR/Transforms/DIScopeForLLVMFuncOp.cpp
@@ -16,7 +16,7 @@
namespace mlir {
namespace LLVM {
-#define GEN_PASS_DEF_DISCOPEFORLLVMFUNCOP
+#define GEN_PASS_DEF_DISCOPEFORLLVMFUNCOPPASS
#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
} // namespace LLVM
} // namespace mlir
@@ -84,8 +84,11 @@ static void addScopeToFunction(LLVM::LLVMFuncOp llvmFunc,
namespace {
/// Add a debug info scope to LLVMFuncOp that are missing it.
-struct DIScopeForLLVMFuncOp
- : public LLVM::impl::DIScopeForLLVMFuncOpBase<DIScopeForLLVMFuncOp> {
+struct DIScopeForLLVMFuncOpPass
+ : public LLVM::impl::DIScopeForLLVMFuncOpPassBase<
+ DIScopeForLLVMFuncOpPass> {
+ using Base::Base;
+
void runOnOperation() override {
ModuleOp module = getOperation();
Location loc = module.getLoc();
@@ -131,7 +134,3 @@ struct DIScopeForLLVMFuncOp
};
} // end anonymous namespace
-
-std::unique_ptr<Pass> mlir::LLVM::createDIScopeForLLVMFuncOpPass() {
- return std::make_unique<DIScopeForLLVMFuncOp>();
-}
More information about the Mlir-commits
mailing list