Fix reference invalidation in SmallVector APIs that pass in a T, taking it by value when it's small enough and trivially copyable, and doing a pointer-to-index-to-pointer dance otherwise.
This doesn't fix all possible reference invalidation, but if it avoids the compile-time regressions from https://reviews.llvm.org/D87326 (which does fix them all) it seems like a good incremental step. The mental model also seems more clear than https://reviews.llvm.org/D91467 (which only fixed invalidation for small enough, trivially copyable T).
I'm currently building a few variants of clang (matching how the patches are sequenced in my local tree (probably they should be committed separately so they can be reverted individually if necessary, but I figured it made more sense to start with a single Phab review)) to test effects on compile-time:
- fix only push_back and single-element insert (tied together since insert uses `push_back)
- fix also N-element versions of append and insert (tied together since insert uses append)
- fix also resize
I'll start with compiling a "big" file a few times (in the other review I used llvm/lib/Target/X86/X86ISelLowering.cpp), but I'm happy to do more work if it seems prudent.