[Mlir-commits] [mlir] [mlir][Transforms] Improve `replaceOpWithMultiple` API (PR #132608)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Mar 24 22:37:38 PDT 2025


================
@@ -898,6 +898,11 @@ class ConversionPatternRewriter final : public PatternRewriter {
   /// Replace the given operation with the new value ranges. The number of op
   /// results and value ranges must match. The given  operation is erased.
   void replaceOpWithMultiple(Operation *op, ArrayRef<ValueRange> newValues);
+  template <typename RangeT>
+  void replaceOpWithMultiple(Operation *op, RangeT &&newValues) {
----------------
MaheshRavishankar wrote:

Ok, I know I pointed out the issue here cause `ArrayRef<ValueRange>` is a list of references but this is doing a copy under the hood. Can we make this `ArrayRef<SmallVector<T>>`. This way, no copy is required, with the caller holding the memory?

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


More information about the Mlir-commits mailing list