[PATCH] D93779: ADT: Fix reference invalidation in SmallVector::push_back and single-element insert

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 14 09:40:34 PST 2021


dblaikie added a comment.

In D93779#2498612 <https://reviews.llvm.org/D93779#2498612>, @xbolva00 wrote:

> In D93779#2498509 <https://reviews.llvm.org/D93779#2498509>, @dblaikie wrote:
>
>> In D93779#2498501 <https://reviews.llvm.org/D93779#2498501>, @lebedev.ri wrote:
>>
>>> Why do we even want to bend over backwards and try to handle broken code correctly,
>>> at the cost of regressed performance for everything,
>>> instead of just adding defensive asserts against such problems,
>>> and letting/telling the user fix the code?
>>
>> I believe the standard library supports this, so I think it's a somewhat awkward limitation to have a standard-library-like container that misses that. (of course the small-mode isn't entirely compatible with std::vector, etc anyway - so some divergence is possible)
>
> But currently the cost (compile time) is too high to be acceptable.

Perhaps - my comment was intended to address "why are we trying to support this rather than using assertions" not the compile time cost question.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93779



More information about the llvm-commits mailing list