[Mlir-commits] [mlir] [mlir] add overload `createDIScopeForLLVMFuncOp` function (PR #111689)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Oct 9 18:46:09 PDT 2024
https://github.com/Observer007 updated https://github.com/llvm/llvm-project/pull/111689
>From 53540e93520450504c3eaa72f6eed652ed3b9571 Mon Sep 17 00:00:00 2001
From: jingzec <jingzec at nvidia.com>
Date: Wed, 9 Oct 2024 07:32:13 -0700
Subject: [PATCH 1/2] add overload create pass function
---
mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h | 4 ++++
.../Dialect/LLVMIR/Transforms/DIScopeForLLVMFuncOp.cpp | 9 +++++++++
2 files changed, 13 insertions(+)
diff --git a/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h b/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h
index 078c7d12f6f22b..c988ffe1a9b3ff 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h
@@ -23,6 +23,10 @@ namespace LLVM {
/// Create a pass to add DIScope to LLVMFuncOp that are missing it.
std::unique_ptr<Pass> createDIScopeForLLVMFuncOpPass();
+struct DIScopeForLLVMFuncOpOptions;
+std::unique_ptr<Pass>
+createDIScopeForLLVMFuncOpPass(const DIScopeForLLVMFuncOpOptions &options);
+
/// Generate the code for registering conversion passes.
#define GEN_PASS_DECL
#define GEN_PASS_REGISTRATION
diff --git a/mlir/lib/Dialect/LLVMIR/Transforms/DIScopeForLLVMFuncOp.cpp b/mlir/lib/Dialect/LLVMIR/Transforms/DIScopeForLLVMFuncOp.cpp
index 052e98ea8b8d48..91cc65d528559f 100644
--- a/mlir/lib/Dialect/LLVMIR/Transforms/DIScopeForLLVMFuncOp.cpp
+++ b/mlir/lib/Dialect/LLVMIR/Transforms/DIScopeForLLVMFuncOp.cpp
@@ -86,6 +86,10 @@ namespace {
/// Add a debug info scope to LLVMFuncOp that are missing it.
struct DIScopeForLLVMFuncOp
: public LLVM::impl::DIScopeForLLVMFuncOpBase<DIScopeForLLVMFuncOp> {
+ DIScopeForLLVMFuncOp() = default;
+ DIScopeForLLVMFuncOp(const mlir::LLVM::DIScopeForLLVMFuncOpOptions &options)
+ : DIScopeForLLVMFuncOpBase(options) {}
+
void runOnOperation() override {
ModuleOp module = getOperation();
Location loc = module.getLoc();
@@ -135,3 +139,8 @@ struct DIScopeForLLVMFuncOp
std::unique_ptr<Pass> mlir::LLVM::createDIScopeForLLVMFuncOpPass() {
return std::make_unique<DIScopeForLLVMFuncOp>();
}
+
+std::unique_ptr<Pass> mlir::LLVM::createDIScopeForLLVMFuncOpPass(
+ const mlir::LLVM::DIScopeForLLVMFuncOpOptions &options) {
+ return std::make_unique<DIScopeForLLVMFuncOp>(options);
+}
>From 4b5ac60db356bc388ecb6f3465d5f3b57da7f5c4 Mon Sep 17 00:00:00 2001
From: jingzec <jingzec at nvidia.com>
Date: Wed, 9 Oct 2024 18:44:38 -0700
Subject: [PATCH 2/2] drop constructor
---
.../include/mlir/Dialect/LLVMIR/Transforms/Passes.h | 7 -------
.../mlir/Dialect/LLVMIR/Transforms/Passes.td | 1 -
.../LLVMIR/Transforms/DIScopeForLLVMFuncOp.cpp | 13 +------------
3 files changed, 1 insertion(+), 20 deletions(-)
diff --git a/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h b/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h
index c988ffe1a9b3ff..c598ffe3602dc1 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h
@@ -20,13 +20,6 @@ namespace mlir {
namespace LLVM {
-/// Create a pass to add DIScope to LLVMFuncOp that are missing it.
-std::unique_ptr<Pass> createDIScopeForLLVMFuncOpPass();
-
-struct DIScopeForLLVMFuncOpOptions;
-std::unique_ptr<Pass>
-createDIScopeForLLVMFuncOpPass(const DIScopeForLLVMFuncOpOptions &options);
-
/// 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..3947f8565c245d 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
@@ -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 91cc65d528559f..e2dca9a244f8a8 100644
--- a/mlir/lib/Dialect/LLVMIR/Transforms/DIScopeForLLVMFuncOp.cpp
+++ b/mlir/lib/Dialect/LLVMIR/Transforms/DIScopeForLLVMFuncOp.cpp
@@ -86,9 +86,7 @@ namespace {
/// Add a debug info scope to LLVMFuncOp that are missing it.
struct DIScopeForLLVMFuncOp
: public LLVM::impl::DIScopeForLLVMFuncOpBase<DIScopeForLLVMFuncOp> {
- DIScopeForLLVMFuncOp() = default;
- DIScopeForLLVMFuncOp(const mlir::LLVM::DIScopeForLLVMFuncOpOptions &options)
- : DIScopeForLLVMFuncOpBase(options) {}
+ using Base::Base;
void runOnOperation() override {
ModuleOp module = getOperation();
@@ -135,12 +133,3 @@ struct DIScopeForLLVMFuncOp
};
} // end anonymous namespace
-
-std::unique_ptr<Pass> mlir::LLVM::createDIScopeForLLVMFuncOpPass() {
- return std::make_unique<DIScopeForLLVMFuncOp>();
-}
-
-std::unique_ptr<Pass> mlir::LLVM::createDIScopeForLLVMFuncOpPass(
- const mlir::LLVM::DIScopeForLLVMFuncOpOptions &options) {
- return std::make_unique<DIScopeForLLVMFuncOp>(options);
-}
More information about the Mlir-commits
mailing list