[Mlir-commits] [mlir] [mlir][Transforms] Add 1:N `matchAndRewrite` overload (PR #116470)

Matthias Springer llvmlistbot at llvm.org
Fri Nov 22 20:51:18 PST 2024


================
@@ -37,7 +37,8 @@ struct CallOpSignatureConversion : public OpConversionPattern<CallOp> {
     // Substitute with the new result types from the corresponding FuncType
     // conversion.
     rewriter.replaceOpWithNewOp<CallOp>(
-        callOp, callOp.getCallee(), convertedResults, adaptor.getOperands());
+        callOp, callOp.getCallee(), convertedResults,
+        getOneToOneAdaptorOperands(adaptor.getOperands()));
----------------
matthias-springer wrote:

Good point. We should be using `rewriter.replaceOpWithMultiple` to support 1:N replacements for the results. I put this into a new PR so that this PR does not get any larger. See #117413. Will rebase this PR on top of #117413.

Also, you're right about `getOneToOneAdaptorOperands`. We should be calling `flattenOperands`. It's in the callee where the N:1 mapping must be recovered, not all the call site. I was confusing op results and operands.


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


More information about the Mlir-commits mailing list