[PATCH] D91467: ADT: Take small enough, trivially copyable T by value in SmallVector (otherwise, assert)

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 17 13:48:08 PST 2020


dexonsmith marked 3 inline comments as done.
dexonsmith added a comment.

In D91467#2395394 <https://reviews.llvm.org/D91467#2395394>, @mehdi_amini wrote:

> Won't we end up with a different behavior (with respect to iterator invalidation) based on the platform?

Yes; that's true of both choices so far (`<= 2 * sizeof(void *)` and `<= 16`). It's not ideal, but maybe it's better than the status quo? Curious if you have an idea for something that would be stable.

A third option that doesn't change behaviour per platform is to always take by-value when it's trivially copyable. Not sure how much that pessimizes large `T`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91467/new/

https://reviews.llvm.org/D91467



More information about the llvm-commits mailing list