[Mlir-commits] [mlir] [MLIR][Transform] Fix PrintOp::build with StringRef (PR #67052)
Jinyun Ye
llvmlistbot at llvm.org
Thu Sep 21 12:02:37 PDT 2023
https://github.com/joey-ye-work created https://github.com/llvm/llvm-project/pull/67052
transform::PrintOp::build(OpBuilder &builder, OperationState &result, StringRef name) does not set name correctly. Calling PrintOp::build(builder, result, "whatever name") is going to end up with a PrintOp with no name.
This patch fixes it by replicating the approach from tablegen created code. Refer to build/mlir/include/mlir/Dialect/Transform/IR/TransformOps.cpp.inc
>From 59d8ed1adfeaf82a2f0741089d662aa2f51ca458 Mon Sep 17 00:00:00 2001
From: "Jinyun (Joey) Ye" <jinyunye at huawei.com>
Date: Thu, 21 Sep 2023 17:33:59 +0100
Subject: [PATCH] [MLIR][Transform] Fix PrintOp::build with StringRef
---
mlir/lib/Dialect/Transform/IR/TransformOps.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
index 23284e14461d8f2..9bcec7ce27365bb 100644
--- a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
+++ b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
@@ -2311,10 +2311,8 @@ void transform::SequenceOp::build(OpBuilder &builder, OperationState &state,
void transform::PrintOp::build(OpBuilder &builder, OperationState &result,
StringRef name) {
- if (!name.empty()) {
- result.addAttribute(PrintOp::getNameAttrName(result.name),
- builder.getStrArrayAttr(name));
- }
+ if (!name.empty())
+ result.getOrAddProperties<Properties>().name = builder.getStringAttr(name);
}
void transform::PrintOp::build(OpBuilder &builder, OperationState &result,
More information about the Mlir-commits
mailing list