mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-15 22:06:32 +00:00

This commit adds an additional overload to `replaceOpWithMultiple` that accepts additional container types. This has been brought up by users of the new `replaceOpWithMultiple` API. In particular, one missing container type was `SmallVector<SmallVector<Value>>`. The "default" `ArrayRef<ValueRange>` container type can lead to use-after-scope errors in cases such as: ```c++ // Compute the replacement value ranges. Some replacements are single // values, some are value ranges. SmallVector<ValueRange> repl; repl.push_back(someValueRange); // OK for (...) { // push_back(Value) triggers an implicit conversion to ValueRange, // which does not own the range. repl.push_back(someValue); // triggers use-after-scope later } rewriter.replaceOpWithMultiple(op, repl); ``` In this example, users should use `SmallVector<SmallVector<Value>> repl;`.
Multi-Level Intermediate Representation
See https://mlir.llvm.org/ for more information.