This is an archive of the discontinued LLVM Phabricator instance.

[SmallVector] Allow SmallVector<T>
AbandonedPublic

Authored by silvas on Dec 2 2020, 4:45 PM.

Details

Reviewers
None
Summary

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.

Diff Detail

Event Timeline

silvas created this revision.Dec 2 2020, 4:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 2 2020, 4:45 PM
silvas requested review of this revision.Dec 2 2020, 4:45 PM
silvas abandoned this revision.Dec 2 2020, 4:46 PM

Created mistakenly (bad script). Abandoning.