HomePhabricator

[SmallVector] Weaken the predicate for the memcpy optimization

Authored by bkramer on May 2 2020, 10:22 AM.

Description

[SmallVector] Weaken the predicate for the memcpy optimization

We don't require the type to be trivially assignable. While the standard
says that only is_trivially_copyable types may be memcpy'd, this seems
overly strict. We never assign the type, so there's no way for the type
to observe that the copy/move construction got elided. This is important
for std::pair<POD, POD>, which is not trivially assignable and probably
never will be because changing that would break ABI.

As a side-effect this no longer allows types with deleted copy/move
constructors in SmallVector. That's an unintended side-effect of
is_trivially_copyable anyways.

Shrinks Release+Asserts clang by 20k.

Details

Committed
bkramerMay 2 2020, 10:40 AM
Parents
rGc0f210d63630: Don't stash types that aren't copyable or moveable into a SmallVector
Branches
Unknown
Tags
Unknown