[Mlir-commits] [mlir] [mlir][Func] Preserve attribute when converting CallOp/ReturnOp signature (PR #127772)
Mehdi Amini
llvmlistbot at llvm.org
Wed Feb 19 04:59:48 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());
----------------
joker-eph wrote:
> Or more conversatively we can preserve some dialect attribute?
"dialect attributes" are just a different way to say "discardable attributes" I believe. The API you mention don't exist, it is called `setDiscardableAttrs()` in the codebase.
https://github.com/llvm/llvm-project/pull/127772
More information about the Mlir-commits
mailing list