[llvm] [LoopIdiom] Use narrower bit widths where possible in `optimizeCRCLoopUsingClmul` (PR #210139)

Sean Clarke via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 17 07:15:20 PDT 2026


================
@@ -1703,18 +1712,21 @@ void LoopIdiomRecognize::optimizeCRCLoopUsingClmul(const PolynomialInfo &Info,
 
   // Step 2: T2(x) = floor(T1(x)/x^TC) * P(x)
   // Input is TC bits and P(x) is CRCBW+1 bits, so result will be CRCBW+TC bits.
+  ClmulGPInput =
+      Builder.CreateZExtOrTrunc(ClmulGPInput, ClmulGPTy, "quot.cast");
----------------
xarkenz wrote:

`TC+CRCBW < 2*TC` if `CRCBW < TC`, the only restriction is that `TC <= DataBW`. `ClmulGPTy` is `CRCBW+TC`, not `CRCBW+1`; `FullGenPoly` only occupies `CRCBW+1` bits, but is zexted. Maybe I misunderstand what you're saying?

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


More information about the llvm-commits mailing list