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

Markus Böck llvmlistbot at llvm.org
Wed Mar 26 01:21:38 PDT 2025


================
@@ -897,7 +897,30 @@ 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);
+  void replaceOpWithMultiple(Operation *op,
+                             ArrayRef<SmallVector<Value, 1>> newValues);
----------------
zero9178 wrote:

```suggestion
                             SmallVector<SmallVector<Value>>&& newValues);
```
We can't use `ArrayRef` as it is "read-only" and elements cannot be moved out of it. We could technically use `MutableArrayRef` but this would have surprising behaviour if elements were to be moved out of it.

Uses below should use `std::move` and `llvm::to_vector` accordingly

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


More information about the Mlir-commits mailing list