[Mlir-commits] [mlir] 214ce4d - [MLIR][Transform] Fix PrintOp::build with StringRef (#67052)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Sep 25 00:58:32 PDT 2023
Author: Jinyun (Joey) Ye
Date: 2023-09-25T09:58:28+02:00
New Revision: 214ce4da351f62d9c4341cf2d7c52ff38b6787a1
URL: https://github.com/llvm/llvm-project/commit/214ce4da351f62d9c4341cf2d7c52ff38b6787a1
DIFF: https://github.com/llvm/llvm-project/commit/214ce4da351f62d9c4341cf2d7c52ff38b6787a1.diff
LOG: [MLIR][Transform] Fix PrintOp::build with StringRef (#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
Added:
Modified:
mlir/lib/Dialect/Transform/IR/TransformOps.cpp
Removed:
################################################################################
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