Change SmallVector functions taking a const T& parameter for
insertion to take T instead when T is trivially copyable and "small
enough" (the heuristic is sizeof(T) <= 2 * sizeof(void *)). When it
applies it avoids iterator invalidation gotchas.
For insert, layer insert_one_maybe_copy between insert and
insert_one_impl in order to copy Elt when we want to take it by
value.
For emplace_back, forward to push_back when we want to take the
parameter by value.
Note: the intent here is to help unblock https://reviews.llvm.org/D87326:
In relation to my comment about insert, it would be a lot easier to implement if this condition was extracted out into a static constexpr variable
A second point is maybe this should be based loosely on the target. Though I'm not super sure on that, WDYT?