summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-11-13 07:23:22 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-11-13 07:23:22 +0000
commitc11bd4229cbc5775ecd39e183e6bdc1835706ee9 (patch)
tree6eff94d94970b1851ad164c086b7e0f400818daa /llvm/lib/Support
parentc77f5fa4f4fa6199915c8922d7679d824c9d2252 (diff)
downloadbcm5719-llvm-c11bd4229cbc5775ecd39e183e6bdc1835706ee9.tar.gz
bcm5719-llvm-c11bd4229cbc5775ecd39e183e6bdc1835706ee9.zip
Read 64 bits at a time in the bitcode reader.
The reading of 64 bit values could still be optimized, but at least this cuts down on the number of virtual calls to fetch more data. llvm-svn: 221865
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/StreamingMemoryObject.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Support/StreamingMemoryObject.cpp b/llvm/lib/Support/StreamingMemoryObject.cpp
index b3723d03981..f0eb83153e0 100644
--- a/llvm/lib/Support/StreamingMemoryObject.cpp
+++ b/llvm/lib/Support/StreamingMemoryObject.cpp
@@ -90,13 +90,12 @@ uint64_t StreamingMemoryObject::getExtent() const {
uint64_t StreamingMemoryObject::readBytes(uint8_t *Buf, uint64_t Size,
uint64_t Address) const {
fetchToPos(Address + Size - 1);
- uint64_t BufferSize = Bytes.size() - BytesSkipped;
- if (Address >= BufferSize)
+ if (Address >= BytesRead)
return 0;
uint64_t End = Address + Size;
- if (End > BufferSize)
- End = BufferSize;
+ if (End > BytesRead)
+ End = BytesRead;
Size = End - Address;
assert(Size >= 0);
memcpy(Buf, &Bytes[Address + BytesSkipped], Size);
OpenPOWER on IntegriCloud