[llvm] [LoopIdiom] Fix a DL-related crash in optimizeCRCLoop (PR #161509)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 1 05:41:24 PDT 2025


================
@@ -1545,6 +1545,12 @@ bool LoopIdiomRecognize::optimizeCRCLoop(const PolynomialInfo &Info) {
   if (TT.getArch() == Triple::hexagon)
     return false;
 
+  // Check that the DataLayout allows us to index into the new 256-entry CRC
+  // table.
+  Type *IdxTy = SE->getDataLayout().getIndexType(M.getContext(), 0);
+  if (IdxTy->getIntegerBitWidth() < 8)
+    return false;
----------------
artagnon wrote:

I'm not sure if there's a better way to do this?

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


More information about the llvm-commits mailing list