HomePhabricator

[SmallVector] Allow SmallVector<T>

Authored by silvas on Dec 3 2020, 10:38 AM.

Description

[SmallVector] Allow SmallVector<T>

This patch adds a capability to SmallVector to decide a number of
inlined elements automatically. The policy is:

  • A minimum of 1 inlined elements, with more as long as

sizeof(SmallVector<T>) <= 64.

  • If sizeof(T) is "too big", then trigger a static_assert: this dodges

the more pathological cases

This is expected to systematically improve SmallVector use in the
LLVM codebase, which has historically been plagued by semi-arbitrary /
cargo culted N parameters, often leading to bad outcomes due to
excessive sizeof(SmallVector<T, N>). This default also makes
programming more convenient by avoiding edit/rebuild cycles due to
forgetting to type the N parameter.

Differential Revision: https://reviews.llvm.org/D92522

Details

Committed
silvasDec 3 2020, 5:21 PM
Differential Revision
D92522: [SmallVector] Allow SmallVector<T>
Parents
rG2f0de582949d: [NewPM] Support --print-before/after in NPM
Branches
Unknown
Tags
Unknown