[llvm] [LoopIdiom] Fix a DL-related crash in optimizeCRCLoop (PR #161509)
Piotr Fusik via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 1 06:01:02 PDT 2025
================
@@ -1598,11 +1604,8 @@ bool LoopIdiomRecognize::optimizeCRCLoop(const PolynomialInfo &Info) {
// crc = (crc << 8) ^ tbl[(iv'th byte of data) ^ (top byte of crc)]
{
auto LoByte = [](IRBuilderBase &Builder, Value *Op, const Twine &Name) {
- Type *OpTy = Op->getType();
- unsigned OpBW = OpTy->getIntegerBitWidth();
- return OpBW > 8
- ? Builder.CreateAnd(Op, ConstantInt::get(OpTy, 0XFF), Name)
- : Op;
+ return Builder.CreateZExtOrTrunc(
+ Op, IntegerType::getInt8Ty(Op->getContext()));
----------------
pfusik wrote:
I like how it is simpler now.
https://github.com/llvm/llvm-project/pull/161509
More information about the llvm-commits
mailing list