diff options
author | Zachary Turner <zturner@google.com> | 2017-05-25 21:12:27 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-05-25 21:12:27 +0000 |
commit | 95c625ecc9067f7215f476f44f01cb0cc0c24ba8 (patch) | |
tree | 277d14e9efd0d1aa111d19a57dae1652fe40e59c /llvm/lib/CodeGen/MachineCopyPropagation.cpp | |
parent | 55256ada254f08bd86b4baa912eb1339af205ed6 (diff) | |
download | bcm5719-llvm-95c625ecc9067f7215f476f44f01cb0cc0c24ba8.tar.gz bcm5719-llvm-95c625ecc9067f7215f476f44f01cb0cc0c24ba8.zip |
Make BinaryStreamReader::readCString a bit faster.
Previously it would do a character by character search for a null
terminator, to account for the fact that an arbitrary stream need not
store its data contiguously so you couldn't just do a memchr. However, the
stream API has a function which will return the longest contiguous chunk
without doing a copy, and by using this function we can do a memchr on the
individual chunks. For certain types of streams like data from object
files etc, this is guaranteed to find the null terminator with only a
single memchr, but even with discontiguous streams such as
MappedBlockStream, it's rare that any given string will cross a block
boundary, so even those will almost always be satisfied with a single
memchr.
This optimization is worth a 10-12% reduction in link time (4.2 seconds ->
3.75 seconds)
Differential Revision: https://reviews.llvm.org/D33503
llvm-svn: 303918
Diffstat (limited to 'llvm/lib/CodeGen/MachineCopyPropagation.cpp')
0 files changed, 0 insertions, 0 deletions