[PATCH] D151977: [X86][NFC]Use ref instead copy in for loop for SDValue::op_values()
Wang, Xin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 1 23:34:03 PDT 2023
XinWang10 added a comment.
In D151977#4390048 <https://reviews.llvm.org/D151977#4390048>, @craig.topper wrote:
> Pretty sure the op is an SDValue not an SDUse.
using op_iterator = SDUse *;
op_iterator op_begin() const { return OperandList; }
op_iterator op_end() const { return OperandList+NumOperands; }
ArrayRef<SDUse> ops() const { return ArrayRef(op_begin(), op_end()); }
/// Iterator for directly iterating over the operand SDValue's.
struct value_op_iterator
: iterator_adaptor_base<value_op_iterator, op_iterator,
std::random_access_iterator_tag, SDValue,
ptrdiff_t, value_op_iterator *,
value_op_iterator *> {
explicit value_op_iterator(SDUse *U = nullptr)
: iterator_adaptor_base(U) {}
const SDValue &operator*() const { return I->get(); }
};
iterator_range<value_op_iterator> op_values() const {
return make_range(value_op_iterator(op_begin()),
value_op_iterator(op_end()));
}
But the operator shows it's a SDUse, and use operator() to re-explain it to SDValue(), is there any wrong here?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151977/new/
https://reviews.llvm.org/D151977
More information about the llvm-commits
mailing list