Loading mlir/include/mlir/IR/UseDefLists.h +7 −4 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ public: /// the IR that uses 'this' to use the other value instead. When this returns /// there are zero uses of 'this'. void replaceAllUsesWith(typename OperandType::ValueType newValue) { assert(this != OperandType::getUseList(newValue) && assert(!newValue || this != OperandType::getUseList(newValue) && "cannot RAUW a value with itself"); while (!use_empty()) use_begin()->set(newValue); Loading Loading @@ -126,7 +126,7 @@ public: void replaceAllUsesWith(ValueType oldValue, ValueType newValue) { assert(this == OperandType::getUseList(oldValue) && "value not attached to this use list"); assert(this != OperandType::getUseList(newValue) && assert(!newValue || this != OperandType::getUseList(newValue) && "cannot RAUW a value with itself"); for (OperandType &use : llvm::make_early_inc_range(getUses(oldValue))) use.set(newValue); Loading Loading @@ -337,6 +337,9 @@ public: /// Return the current value being used by this operand. Value get() const; /// Set the operand to the given value. void set(Value value); /// Return which operand this is in the operand list of the User. unsigned getOperandNumber(); }; Loading mlir/lib/IR/Value.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,11 @@ Value OpOperand::get() const { return IROperand<OpOperand, detail::OpaqueValue>::get(); } /// Set the operand to the given value. void OpOperand::set(Value value) { IROperand<OpOperand, detail::OpaqueValue>::set(value); } /// Return which operand this is in the operand list. unsigned OpOperand::getOperandNumber() { return this - &getOwner()->getOpOperands()[0]; Loading Loading
mlir/include/mlir/IR/UseDefLists.h +7 −4 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ public: /// the IR that uses 'this' to use the other value instead. When this returns /// there are zero uses of 'this'. void replaceAllUsesWith(typename OperandType::ValueType newValue) { assert(this != OperandType::getUseList(newValue) && assert(!newValue || this != OperandType::getUseList(newValue) && "cannot RAUW a value with itself"); while (!use_empty()) use_begin()->set(newValue); Loading Loading @@ -126,7 +126,7 @@ public: void replaceAllUsesWith(ValueType oldValue, ValueType newValue) { assert(this == OperandType::getUseList(oldValue) && "value not attached to this use list"); assert(this != OperandType::getUseList(newValue) && assert(!newValue || this != OperandType::getUseList(newValue) && "cannot RAUW a value with itself"); for (OperandType &use : llvm::make_early_inc_range(getUses(oldValue))) use.set(newValue); Loading Loading @@ -337,6 +337,9 @@ public: /// Return the current value being used by this operand. Value get() const; /// Set the operand to the given value. void set(Value value); /// Return which operand this is in the operand list of the User. unsigned getOperandNumber(); }; Loading
mlir/lib/IR/Value.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,11 @@ Value OpOperand::get() const { return IROperand<OpOperand, detail::OpaqueValue>::get(); } /// Set the operand to the given value. void OpOperand::set(Value value) { IROperand<OpOperand, detail::OpaqueValue>::set(value); } /// Return which operand this is in the operand list. unsigned OpOperand::getOperandNumber() { return this - &getOwner()->getOpOperands()[0]; Loading