1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
llvm-mirror/unittests
Pavel Labath f85485df31 Resubmit r325107 (case folding DJB hash)
The issue was that the has function was generating different results depending
on the signedness of char on the host platform. This commit fixes the issue by
explicitly using an unsigned char type to prevent sign extension and
adds some extra tests.

The original commit message was:

This patch implements a variant of the DJB hash function which folds the
input according to the algorithm in the Dwarf 5 specification (Section
6.1.1.4.5), which in turn references the Unicode Standard (Section 5.18,
"Case Mappings").

To achieve this, I have added a llvm::sys::unicode::foldCharSimple
function, which performs this mapping. The implementation of this
function was generated from the CaseMatching.txt file from the Unicode
spec using a python script (which is also included in this patch). The
script tries to optimize the function by coalescing adjecant mappings
with the same shift and stride (terms I made up). Theoretically, it
could be made a bit smarter and merge adjecant blocks that were
interrupted by only one or two characters with exceptional mapping, but
this would save only a couple of branches, while it would greatly
complicate the implementation, so I deemed it was not worth it.

Since we assume that the vast majority of the input characters will be
US-ASCII, the folding hash function has a fast-path for handling these,
and only whips out the full decode+fold+encode logic if we encounter a
character outside of this range. It might be possible to implement the
folding directly on utf8 sequences, but this would also bring a lot of
complexity for the few cases where we will actually need to process
non-ascii characters.

Reviewers: JDevlieghere, aprantl, probinson, dblaikie

Subscribers: mgorny, hintonda, echristo, clayborg, vleschuk, llvm-commits

Differential Revision: https://reviews.llvm.org/D42740

llvm-svn: 325732
2018-02-21 22:36:31 +00:00
..
ADT [APInt] Fix extractBits to correctly handle Result.isSingleWord() case. 2018-02-16 01:44:36 +00:00
Analysis [SCEV] Do not cache S -> V if S is not equivalent of V 2018-01-09 06:47:14 +00:00
AsmParser Remove every uses of getGlobalContext() in LLVM (but the C API) 2016-04-14 21:59:01 +00:00
BinaryFormat [BinaryFormat] Fix out of bounds read. 2017-08-31 12:50:42 +00:00
Bitcode Pass a reference to a module to the bitcode writer. 2018-02-14 19:11:32 +00:00
CodeGen [GISel]: Add pattern matchers for G_BITCAST/PTRTOINT/INTTOPTR 2018-02-19 23:11:53 +00:00
DebugInfo Silence an unsigned vs signed compare warning. 2018-02-16 22:46:45 +00:00
ExecutionEngine [ORC] Switch to shared_ptr ownership for SymbolSources in VSOs. 2018-02-21 21:55:57 +00:00
FuzzMutate [FuzzMutate] Inst deleter doesn't work with PhiNodes 2018-01-25 09:22:18 +00:00
IR [IRBuilder] fix CreateMaxNum to actually produce maxnum (PR36454) 2018-02-20 18:21:43 +00:00
LineEditor Remove autoconf support 2016-01-26 21:29:08 +00:00
Linker Fix build for LLVM unittests 2017-09-15 21:12:13 +00:00
MC Move Object format code to lib/BinaryFormat. 2017-06-07 03:48:56 +00:00
MI Followup on Proposal to move MIR physical register namespace to '$' sigil. 2018-01-31 22:04:26 +00:00
Object Fix unittest for buildbot with mips host (32bit big endian) from r295174 2017-02-15 16:03:22 +00:00
ObjectYAML Move ObjectYAML code to a new library. 2016-03-01 19:15:06 +00:00
Option [Option] For typo '-foo', suggest '--foo' 2018-01-09 19:38:04 +00:00
ProfileData Remove redundant includes from unittests. 2017-12-13 21:31:05 +00:00
Support Resubmit r325107 (case folding DJB hash) 2018-02-21 22:36:31 +00:00
Target Reapply "[GlobalISel] Remove the GISelAccessor API." 2017-08-15 22:31:51 +00:00
tools [CMake] Use PRIVATE in target_link_libraries for executables 2017-12-05 21:49:56 +00:00
Transforms Pass a module reference to CloneModule. 2018-02-14 19:50:40 +00:00
XRay [XRay][graph] Disambiguate name of type from member name 2017-02-10 06:59:25 +00:00
CMakeLists.txt Reland 'Classify llvm-cfi-verify.' 2017-10-11 20:35:01 +00:00