Page MenuHomePhabricator

[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

Unit TestsFailed

TimeTest
360 msx64 debian > HWAddressSanitizer-x86_64.TestCases::sizes.cpp
Script: -- : 'RUN: at line 3'; /mnt/disks/ssd0/agent/llvm-project/build/./bin/clang --driver-mode=g++ -m64 -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -mcmodel=large -mllvm -hwasan-globals -mllvm -hwasan-use-short-granules -mllvm -hwasan-instrument-landing-pads=0 -mllvm -hwasan-instrument-personality-functions /mnt/disks/ssd0/agent/llvm-project/compiler-rt/test/hwasan/TestCases/sizes.cpp -nostdlib++ -lstdc++ -o /mnt/disks/ssd0/agent/llvm-project/build/projects/compiler-rt/test/hwasan/X86_64/TestCases/Output/sizes.cpp.tmp

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.