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

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 23 04:22:35 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:

So, the "nodata" test variants cover the case of LHS, and the non-"nodata" test variants cover LHSAux (where BW of LHSAux is permitted to be < that of LHS). The case when the BW of LHSAux > LHS is covered in the changed test.

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


More information about the llvm-commits mailing list