[Mlir-commits] [mlir] [mlir] add overload `createDIScopeForLLVMFuncOp` function (PR #111689)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Oct 9 07:40:24 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: None (Observer007)
<details>
<summary>Changes</summary>
follow up work of https://github.com/llvm/llvm-project/pull/106229, add create pass overload function to create pass.
---
Full diff: https://github.com/llvm/llvm-project/pull/111689.diff
2 Files Affected:
- (modified) mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h (+4)
- (modified) mlir/lib/Dialect/LLVMIR/Transforms/DIScopeForLLVMFuncOp.cpp (+9)
``````````diff
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);
+}
``````````
</details>
https://github.com/llvm/llvm-project/pull/111689
More information about the Mlir-commits
mailing list