[Mlir-commits] [mlir] Update documentation for MutableOperandRange (PR #65865)

Mehdi Amini llvmlistbot at llvm.org
Sat Sep 9 15:48:59 PDT 2023


================
@@ -112,6 +112,10 @@ class OperandRangeRange final
 
 /// This class provides a mutable adaptor for a range of operands. It allows for
 /// setting, inserting, and erasing operands from the given range.
+///
+/// (Note that when using AttrSizedOperandSegments, making changes to a
+/// MutableOperandRange invalidates other MutableOperandRange's in memory; you
+/// must get a new mutable adaptor for the other operand ranges).
----------------
joker-eph wrote:

This is true even without using `AttrSizedOperandSegments` I believe.

Look at the members:
```
  /// The owning operation of this range.
  Operation *owner;
  /// The start index of the operand range within the owner operand list, and
  /// the length starting from `start`.
  unsigned start, length;
  ```

So any addition or removal of an operand for the `owner` Operation would invalidate the range.

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


More information about the Mlir-commits mailing list