[Mlir-commits] [mlir] [mlir][Func] Preserve attribute when converting CallOp/ReturnOp signature (PR #127772)

Matthias Springer llvmlistbot at llvm.org
Wed Mar 5 07:09:57 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());
----------------
matthias-springer wrote:

I've seen too many workarounds related to discardable attribute handling. We also have some in our code base. I will discuss this with a few more people and send a prototype+RFC for the attribute converter idea if it works out.

https://github.com/llvm/llvm-project/pull/127772


More information about the Mlir-commits mailing list