Skip to content

Commit 1ba5f11

Browse files
Observer007DanielCChen
authored andcommitted
[mlir] add overload createDIScopeForLLVMFuncOp function (llvm#111689)
follow up work of llvm#106229, add create pass overload function to create pass. --------- Co-authored-by: jingzec <[email protected]>
1 parent 35882fc commit 1ba5f11

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ namespace mlir {
2020

2121
namespace LLVM {
2222

23-
/// Create a pass to add DIScope to LLVMFuncOp that are missing it.
24-
std::unique_ptr<Pass> createDIScopeForLLVMFuncOpPass();
25-
2623
/// Generate the code for registering conversion passes.
2724
#define GEN_PASS_DECL
2825
#define GEN_PASS_REGISTRATION

mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def NVVMOptimizeForTarget : Pass<"llvm-optimize-for-nvvm-target"> {
4848
let constructor = "::mlir::NVVM::createOptimizeForTargetPass()";
4949
}
5050

51-
def DIScopeForLLVMFuncOp : Pass<"ensure-debug-info-scope-on-llvm-func", "::mlir::ModuleOp"> {
51+
def DIScopeForLLVMFuncOpPass : Pass<"ensure-debug-info-scope-on-llvm-func", "::mlir::ModuleOp"> {
5252
let summary = "Materialize LLVM debug info subprogram attribute on every LLVMFuncOp";
5353
let description = [{
5454
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:
6060
line-by-line or get a backtrace with line numbers.
6161
}];
6262

63-
let constructor = "mlir::LLVM::createDIScopeForLLVMFuncOpPass()";
6463
let options = [
6564
Option<"emissionKind", "emission-kind", "mlir::LLVM::DIEmissionKind",
6665
/*default=*/"mlir::LLVM::DIEmissionKind::LineTablesOnly", "Emission kind to generate debug info.",

mlir/lib/Dialect/LLVMIR/Transforms/DIScopeForLLVMFuncOp.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
namespace mlir {
1818
namespace LLVM {
19-
#define GEN_PASS_DEF_DISCOPEFORLLVMFUNCOP
19+
#define GEN_PASS_DEF_DISCOPEFORLLVMFUNCOPPASS
2020
#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
2121
} // namespace LLVM
2222
} // namespace mlir
@@ -84,8 +84,11 @@ static void addScopeToFunction(LLVM::LLVMFuncOp llvmFunc,
8484

8585
namespace {
8686
/// Add a debug info scope to LLVMFuncOp that are missing it.
87-
struct DIScopeForLLVMFuncOp
88-
: public LLVM::impl::DIScopeForLLVMFuncOpBase<DIScopeForLLVMFuncOp> {
87+
struct DIScopeForLLVMFuncOpPass
88+
: public LLVM::impl::DIScopeForLLVMFuncOpPassBase<
89+
DIScopeForLLVMFuncOpPass> {
90+
using Base::Base;
91+
8992
void runOnOperation() override {
9093
ModuleOp module = getOperation();
9194
Location loc = module.getLoc();
@@ -131,7 +134,3 @@ struct DIScopeForLLVMFuncOp
131134
};
132135

133136
} // end anonymous namespace
134-
135-
std::unique_ptr<Pass> mlir::LLVM::createDIScopeForLLVMFuncOpPass() {
136-
return std::make_unique<DIScopeForLLVMFuncOp>();
137-
}

0 commit comments

Comments
 (0)