[PATCH] D90320: [llvm][StringExtras] Use a lookup table for `hexDigitValue`

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 12:11:17 PDT 2020


rriddle added a comment.

In D90320#2359805 <https://reviews.llvm.org/D90320#2359805>, @rriddle wrote:

> In D90320#2359587 <https://reviews.llvm.org/D90320#2359587>, @dblaikie wrote:
>
>> If you like you could try rephrasing this as a programmatic initialization rather than writing it all out manually, might make it easier to read/look more like the original code (except applied as a loop over the range/table) and hopefully can be phrased in such a way that the compiler boils it down to the same values anyway.
>
> Thanks for the suggestion! That would definitely be much nicer. I tried about 4-5 different ways of doing the initialization and I could only get clang to generate a proper LUT in C++17(using constexpr lambda initialization with std::array), not C++14. I couldn't get GCC to do the right thing in either C++14 or C++17. Do you have any suggestions on how to do the initialization?

NVM, found something that works.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90320/new/

https://reviews.llvm.org/D90320



More information about the llvm-commits mailing list