[llvm] [LoopIdiom] Use HashRecognize to optimize CRC (PR #143208)

Piotr Fusik via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 9 00:56:38 PDT 2025


================
@@ -620,9 +624,10 @@ HashRecognize::recognizeCRC() const {
   if (!checkExtractBits(ResultBits, TC, IsZero, *ByteOrderSwapped))
     return ErrBits(ResultBits, TC, *ByteOrderSwapped);
 
-  const Value *LHSAux = SimpleRecurrence ? SimpleRecurrence.Start : nullptr;
+  Value *LHSAux = SimpleRecurrence ? SimpleRecurrence.Start : nullptr;
+  const CRCTable &SarwateTable = genSarwateTable(GenPoly, *ByteOrderSwapped);
----------------
pfusik wrote:

Why take a reference to `CRCTable` here?
How about replacing the function that computes the whole table with a function that creates i-th element?

https://github.com/llvm/llvm-project/pull/143208


More information about the llvm-commits mailing list