[llvm][StringExtras] Use a lookup table for `hexDigitValue`
authorRiver Riddle <riddleriver@gmail.com>
Wed, 28 Oct 2020 23:46:31 +0000 (16:46 -0700)
committerRiver Riddle <riddleriver@gmail.com>
Wed, 28 Oct 2020 23:58:06 +0000 (16:58 -0700)
commitf6a6f27edb3991154393976e9e8f7b88542d406c
tree054daecfca972df9065b3f866d08fcf59a34db72
parent1095419b10ff222c3cc362be27d97ff561a2181b
[llvm][StringExtras] Use a lookup table for `hexDigitValue`

This method is at the core of the conversion from hex to binary, and using a lookup table great improves the compile time of hex conversions.

Context: In MLIR we use hex strings to represent very large constants in the textual format of the IR. These changes lead to a large decrease in compile time when parsing these constants (>1 second -> 350 miliseconds).

Differential Revision: https://reviews.llvm.org/D90320
llvm/include/llvm/ADT/StringExtras.h