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

Markus Böck via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Nov 16 02:05:56 PST 2024


================
@@ -1538,10 +1607,9 @@ void ConversionPatternRewriter::replaceOp(Operation *op, ValueRange newValues) {
     impl->logger.startLine()
         << "** Replace : '" << op->getName() << "'(" << op << ")\n";
   });
-  SmallVector<ReplacementValues> newVals(newValues.size());
-  for (auto [index, val] : llvm::enumerate(newValues))
-    if (val)
-      newVals[index].push_back(val);
+  SmallVector<ValueRange> newVals;
+  for (int i = 0; i < newValues.size(); ++i)
+    newVals.push_back(newValues.slice(i, 1));
----------------
zero9178 wrote:

```suggestion
  for (Value value : newValues)
    newVals.push_back(value);
```

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


More information about the llvm-branch-commits mailing list