[Mlir-commits] [mlir] [MLIR][Transform] Fix PrintOp::build with StringRef (PR #67052)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Sep 25 00:53:36 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
<details>
<summary>Changes</summary>
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
---
Full diff: https://github.com/llvm/llvm-project/pull/67052.diff
1 Files Affected:
- (modified) mlir/lib/Dialect/Transform/IR/TransformOps.cpp (+2-4)
``````````diff
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,
``````````
</details>
https://github.com/llvm/llvm-project/pull/67052
More information about the Mlir-commits
mailing list