[llvm] [HashRecognize] Check TC against bitwidth of LHSAux (PR #144881)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 23 06:37:32 PDT 2025


================
@@ -583,6 +577,13 @@ HashRecognize::recognizeCRC() const {
       return "Recurrences not intertwined with XOR";
   }
 
+  // Make sure that the TC doesn't exceed the bitwidth of LHSAux, or LHS.
+  Value *LHS = ConditionalRecurrence.Start;
+  Value *LHSAux = SimpleRecurrence ? SimpleRecurrence.Start : nullptr;
+  if (TC > (LHSAux ? LHSAux->getType()->getIntegerBitWidth()
+                   : LHS->getType()->getIntegerBitWidth()))
----------------
artagnon wrote:

Sorry, I used the terminology in llvm-test-suite: these tests are called `*crc.init.{li,arg}`, where the LHSAux doesn't evolve in the loop, but rather, crc is already XOR'ed with this data outside the loop, either in the preheader, or in the caller (and it is passed as an argument).

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


More information about the llvm-commits mailing list