[llvm] [NFC][LLVM] Refactor MachineInstr operand accessors (PR #137261)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 25 08:02:39 PDT 2025


================
@@ -676,68 +672,61 @@ class MachineInstr
   const_mop_iterator operands_begin() const { return Operands; }
   const_mop_iterator operands_end() const { return Operands + NumOperands; }
 
-  iterator_range<mop_iterator> operands() {
-    return make_range(operands_begin(), operands_end());
+  MutableArrayRef<MachineOperand> operands() {
----------------
s-barannikov wrote:

> Does iterator_range<> hide it any more than this?

But of course, that's what iterators do. We could want to store explicit defs/uses, implicit defs/uses separately and iterator will hide this from the clients. Changing it to `ArrayRef` makes it impossible to store the lists separately.


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


More information about the llvm-commits mailing list