aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
authorAndrew Browne <browneee@google.com>2020-04-24 19:26:11 -0700
committerAndrew Browne <browneee@google.com>2020-04-27 13:41:01 -0700
commitdda3c19a3618dce9492687f8e880e7a73486ee98 (patch)
tree554e6678970b3e1b91e07a59e2fcaa8044a4cf8f /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
parentf8990feb125a0f8d3f2892a589bc6fad3c430858 (diff)
downloadllvm-dda3c19a3618dce9492687f8e880e7a73486ee98.zip
llvm-dda3c19a3618dce9492687f8e880e7a73486ee98.tar.gz
llvm-dda3c19a3618dce9492687f8e880e7a73486ee98.tar.bz2
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. This recommit fixes the same template being instantiated twice on platforms where uintptr_t is the same as uint32_t.
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
0 files changed, 0 insertions, 0 deletions