[all-commits] [llvm/llvm-project] b5f0ea: ADT: SmallVector size/capacity use word-size integ...
Andrew Browne via All-commits
all-commits at lists.llvm.org
Fri Apr 24 18:59:28 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: b5f0eae1dc3c09c020cdf9d07238dec9acdacf5f
https://github.com/llvm/llvm-project/commit/b5f0eae1dc3c09c020cdf9d07238dec9acdacf5f
Author: Andrew Browne <browneee at google.com>
Date: 2020-04-24 (Fri, 24 Apr 2020)
Changed paths:
M llvm/include/llvm/ADT/SmallVector.h
M llvm/lib/Support/SmallVector.cpp
Log Message:
-----------
ADT: SmallVector size/capacity use word-size integers when elements are small
SmallVector currently uses 32bit integers for size and capacity to reduce
sizeof(SmallVector). This limits the number of elements to UINT32_MAX.
For a SmallVector<char>, this limits the SmallVector size to only 4GB.
Buffering bitcode output uses SmallVector<char>, but needs >4GB output.
This changes SmallVector size and capacity to conditionally use word-size
integers if the element type is small (<4 bytes). For larger elements types,
the vector size can reach ~16GB with 32bit size.
Making this conditional on the element type provides both the smaller
sizeof(SmallVector) for larger types which are unlikely to grow so large,
and supports larger capacities for smaller element types.
More information about the All-commits
mailing list