[PATCH] D17911: Bitcode reader: Inline readAbbreviatedField in readRecord and move the enclosing loop in each case (NFC)
Mehdi AMINI via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 5 23:18:44 PST 2016
joker.eph created this revision.
joker.eph added a reviewer: rafael.
joker.eph added a subscriber: llvm-commits.
This make readRecord 20% faster, measured on an LTO build
http://reviews.llvm.org/D17911
Files:
lib/Bitcode/Reader/BitstreamReader.cpp
Index: lib/Bitcode/Reader/BitstreamReader.cpp
===================================================================
--- lib/Bitcode/Reader/BitstreamReader.cpp
+++ lib/Bitcode/Reader/BitstreamReader.cpp
@@ -211,8 +211,21 @@
report_fatal_error("Array element type can't be an Array or a Blob");
// Read all the elements.
- for (; NumElts; --NumElts)
- Vals.push_back(readAbbreviatedField(*this, EltEnc));
+ switch (EltEnc.getEncoding()) {
+ default:
+ llvm_unreachable("Unexpected case");
+ case BitCodeAbbrevOp::Fixed:
+ for (; NumElts; --NumElts)
+ Vals.push_back(Read((unsigned)EltEnc.getEncodingData()));
+ break;
+ case BitCodeAbbrevOp::VBR:
+ for (; NumElts; --NumElts)
+ Vals.push_back(ReadVBR64((unsigned)EltEnc.getEncodingData()));
+ break;
+ case BitCodeAbbrevOp::Char6:
+ for (; NumElts; --NumElts)
+ Vals.push_back(BitCodeAbbrevOp::DecodeChar6(Read(6)));
+ }
continue;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17911.49893.patch
Type: text/x-patch
Size: 1048 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160306/70078b4a/attachment.bin>
More information about the llvm-commits
mailing list