RValue::RValue(const RValue &copied, SILGenFunction &gen, SILLocation l) : type(copied.type), elementsToBeAdded(copied.elementsToBeAdded) { assert((copied.isComplete() || copied.isUsed()) && "can't copy incomplete rvalue"); values.reserve(copied.values.size()); for (ManagedValue value : copied.values) { values.push_back(value.copy(gen, l)); } }
bool RValue::isObviouslyEqual(const RValue &rhs) const { assert(isComplete() && rhs.isComplete() && "Comparing incomplete rvalues"); // Compare the count of elements instead of the type. if (values.size() != rhs.values.size()) return false; return std::equal(values.begin(), values.end(), rhs.values.begin(), [](const ManagedValue &lhs, const ManagedValue &rhs) -> bool { return areObviouslySameValue(lhs.getValue(), rhs.getValue()); }); }