[PATCH] D68570: Unify the two CRC implementations

Hans Wennborg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 04:48:53 PDT 2019


hans created this revision.
hans added reviewers: majnemer, evgeny777, rnk.
Herald added subscribers: seiya, jakehehrlich, hiraditya, mgorny.
Herald added a reviewer: alexshap.
Herald added a reviewer: rupprecht.
Herald added a reviewer: jhenderson.
Herald added a project: LLVM.

David added the JamCRC implementation in r246590. More recently, Eugene added a CRC-32 implementation in r357901, which falls back to zlib's crc32 function if present.

These checksums are essentially the same, so having multiple implementations seems unnecessary. This replaces the CRC-32 implementation with the simpler one from JamCRC, and implements the JamCRC interface in terms of CRC-32 since this means it can use zlib's implementation when available, saving a few bytes and potentially making it faster.

JamCRC took an ArrayRef<char> argument, and CRC-32 took a StringRef. This patch changes it to ArrayRef<uint8_t> which I think is the best choice, simplifies a few of the callers nicely.

Please take a look!


https://reviews.llvm.org/D68570

Files:
  lld/COFF/PDB.cpp
  llvm/include/llvm/Support/CRC.h
  llvm/include/llvm/Support/JamCRC.h
  llvm/lib/DebugInfo/PDB/Native/Hash.cpp
  llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
  llvm/lib/DebugInfo/PDB/Native/TpiHashing.cpp
  llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
  llvm/lib/MC/WinCOFFObjectWriter.cpp
  llvm/lib/Support/CMakeLists.txt
  llvm/lib/Support/CRC.cpp
  llvm/lib/Support/JamCRC.cpp
  llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
  llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
  llvm/tools/llvm-objcopy/CopyConfig.cpp
  llvm/unittests/Support/CRCTest.cpp
  llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68570.223504.patch
Type: text/x-patch
Size: 21027 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191007/4229b594/attachment.bin>


More information about the llvm-commits mailing list