[llvm-branch-commits] [mlir] [mlir][Transforms] Add 1:N `matchAndRewrite` overload (PR #116470)
Matthias Springer via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat Nov 16 17:30:58 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));
----------------
matthias-springer wrote:
This is a tricky one. I had the code that you suggested in an earlier version, but I got ASAN errors. (I think it was stack-use-after-free.) I think the problem is that `ValueRange` stores a pointer to the `Value` object, but the `Value` goes out of scope. (
https://github.com/llvm/llvm-project/pull/116470
More information about the llvm-branch-commits
mailing list