diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2018-06-23 18:39:44 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2018-06-23 18:39:44 +0000 |
commit | f4c82cffc6882715045d97f72d989703b643f4ad (patch) | |
tree | 3752bb9f5f7a2fd40281a402736b1a36c29a6da3 /llvm/lib/Support/SmallVector.cpp | |
parent | c1b173a6362021a30a55d23b098cdfb9a75f6f6c (diff) | |
download | bcm5719-llvm-f4c82cffc6882715045d97f72d989703b643f4ad.tar.gz bcm5719-llvm-f4c82cffc6882715045d97f72d989703b643f4ad.zip |
ADT: Use EBO to shrink SmallVector size 1
SmallVectorStorage is empty when its size is 1; use inheritance so that
the empty base class optimization kicks in.
llvm-svn: 335421
Diffstat (limited to 'llvm/lib/Support/SmallVector.cpp')
-rw-r--r-- | llvm/lib/Support/SmallVector.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Support/SmallVector.cpp b/llvm/lib/Support/SmallVector.cpp index ccab4a125aa..e8e3498968c 100644 --- a/llvm/lib/Support/SmallVector.cpp +++ b/llvm/lib/Support/SmallVector.cpp @@ -14,6 +14,10 @@ #include "llvm/ADT/SmallVector.h" using namespace llvm; +// Check that no bytes are wasted. +static_assert(sizeof(SmallVector<void *, 1>) == sizeof(void *) * 4, + "wasted space in SmallVector size 1; missing EBO?"); + /// grow_pod - This is an implementation of the grow() method which only works /// on POD-like datatypes and is out of line to reduce code duplication. void SmallVectorBase::grow_pod(void *FirstEl, size_t MinSizeInBytes, |