[Mlir-commits] [mlir] [mlir][Func] Preserve attribute when converting CallOp/ReturnOp signature (PR #127772)
Hongren Zheng
llvmlistbot at llvm.org
Wed Feb 19 06:18:47 PST 2025
================
@@ -126,8 +127,9 @@ class ReturnOpTypeConversion : public OpConversionPattern<ReturnOp> {
LogicalResult
matchAndRewrite(ReturnOp op, OneToNOpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const final {
- rewriter.replaceOpWithNewOp<ReturnOp>(op,
- flattenValues(adaptor.getOperands()));
+ rewriter
+ .replaceOpWithNewOp<ReturnOp>(op, flattenValues(adaptor.getOperands()))
+ ->setAttrs(op->getAttrs());
----------------
ZenithalHourlyRate wrote:
The design of these callbacks could be discussed in the discourse and I'm happy to be tagged and involved there.
The decision for this PR is then accepting, rejecting or pending and waiting for the discussion above to materialize? I still prefer a consistent behavior among func::FuncOp/CallOp/ReturnOp for now and the default behavior, as the downstream has no ability to manipulate them now, should be preserving.
For example, there might be some attribute set to the func::FuncOp for some purpose, which I believe is fairly common, and then a simple DialectConversion pass will clear it and the user has to workaround it everywhere.
https://github.com/llvm/llvm-project/pull/127772
More information about the Mlir-commits
mailing list