[PATCH] D16285: Bitcode reader: replace DecodeChar6() with a lookup table (NFC)

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 17 21:51:16 PST 2016


joker.eph created this revision.
joker.eph added reviewers: rafael, dexonsmith.
joker.eph added a subscriber: llvm-commits.

Measured to be more performant when reading bitcode.

http://reviews.llvm.org/D16285

Files:
  include/llvm/Bitcode/BitCodes.h

Index: include/llvm/Bitcode/BitCodes.h
===================================================================
--- include/llvm/Bitcode/BitCodes.h
+++ include/llvm/Bitcode/BitCodes.h
@@ -147,12 +147,8 @@
 
   static char DecodeChar6(unsigned V) {
     assert((V & ~63) == 0 && "Not a Char6 encoded character!");
-    if (V < 26)       return V+'a';
-    if (V < 26+26)    return V-26+'A';
-    if (V < 26+26+10) return V-26-26+'0';
-    if (V == 62)      return '.';
-    if (V == 63)      return '_';
-    llvm_unreachable("Not a value Char6 character!");
+    return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._"
+        [V];
   }
 
 };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16285.45148.patch
Type: text/x-patch
Size: 657 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160118/99587a8a/attachment.bin>


More information about the llvm-commits mailing list