[Mlir-commits] [mlir] [mlir][PDL] PDLToPDLInterp: Use the pdl pattern name in the generated rewriter. (PR #149481)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Jul 18 02:02:07 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: None (jumerckx)
<details>
<summary>Changes</summary>
Before, the rewriters generated by `convert-pdl-to-pdl-interp` had a generic `"pdl_generated_rewriter"` name. With this change, the name from the original pdl pattern is kept for the rewriter. This makes it easier to relate the two.
---
Full diff: https://github.com/llvm/llvm-project/pull/149481.diff
1 Files Affected:
- (modified) mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp (+7-1)
``````````diff
diff --git a/mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp b/mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp
index 7d20109b3db59..3a1c1fd2d57af 100644
--- a/mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp
+++ b/mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp
@@ -632,8 +632,14 @@ void PatternLowering::generate(SuccessNode *successNode, Block *¤tBlock) {
SymbolRefAttr PatternLowering::generateRewriter(
pdl::PatternOp pattern, SmallVectorImpl<Position *> &usedMatchValues) {
builder.setInsertionPointToEnd(rewriterModule.getBody());
+ // Get the pattern name if available, otherwise use default
+ StringRef rewriterName = "pdl_generated_rewriter";
+ if (auto symName = pattern.getSymName()) {
+ rewriterName = symName.value();
+ }
+
auto rewriterFunc = builder.create<pdl_interp::FuncOp>(
- pattern.getLoc(), "pdl_generated_rewriter",
+ pattern.getLoc(), rewriterName,
builder.getFunctionType({}, {}));
rewriterSymbolTable.insert(rewriterFunc);
``````````
</details>
https://github.com/llvm/llvm-project/pull/149481
More information about the Mlir-commits
mailing list