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

via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 17 08:16:20 PDT 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

* 179123 tests passed
* 3551 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### LLVM
<details>
<summary>LLVM.Transforms/LoopIdiom/cyclic-redundancy-check.ll</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt -passes=loop-idiom -S /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/LoopIdiom/cyclic-redundancy-check.ll | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefixes=ALL,TABLE /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/LoopIdiom/cyclic-redundancy-check.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt -passes=loop-idiom -S /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/LoopIdiom/cyclic-redundancy-check.ll
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefixes=ALL,TABLE /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/LoopIdiom/cyclic-redundancy-check.ll
# note: command had no output on stdout or stderr
# RUN: at line 3
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt -passes=loop-idiom -loop-idiom-force-crc-clmul -S /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/LoopIdiom/cyclic-redundancy-check.ll | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefixes=ALL,CLMUL /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/LoopIdiom/cyclic-redundancy-check.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt -passes=loop-idiom -loop-idiom-force-crc-clmul -S /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/LoopIdiom/cyclic-redundancy-check.ll
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefixes=ALL,CLMUL /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/LoopIdiom/cyclic-redundancy-check.ll
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/LoopIdiom/cyclic-redundancy-check.ll:1084:15: error: CLMUL-NEXT: is not on the line after the previous match
# | ; CLMUL-NEXT: [[CRC_CAST:%.*]] = zext i32 [[CHECKSUM]] to i36
# |               ^
# | <stdin>:381:2: note: 'next' match was here
# |  %crc.recast = zext i32 %checksum to i36
# |  ^
# | <stdin>:372:7: note: previous match ended here
# | entry:
# |       ^
# | <stdin>:373:1: note: non-matching line after previous match is here
# |  %crc.cast = trunc i32 %checksum to i4
# | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/LoopIdiom/cyclic-redundancy-check.ll:1149:15: error: CLMUL-NEXT: is not on the line after the previous match
# | ; CLMUL-NEXT: [[CRC_CAST:%.*]] = zext i32 [[CHECKSUM]] to i62
# |               ^
# | <stdin>:406:2: note: 'next' match was here
# |  %crc.recast = zext i32 %checksum to i62
# |  ^
# | <stdin>:397:7: note: previous match ended here
# | entry:
# |       ^
# | <stdin>:398:1: note: non-matching line after previous match is here
# |  %crc.cast = trunc i32 %checksum to i30
# | ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/LoopIdiom/cyclic-redundancy-check.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |              .
# |              .
# |              .
# |            367:  ret i16 %crc.next.lcssa 
# |            368: } 
# |            369:  
# |            370: ; Function Attrs: optsize 
# |            371: define i32 @crc32.le.tc4.data32(i32 %checksum, i32 %msg) #0 { 
# |            372: entry: 
# | next:1084'0          {   search range start (exclusive)
# |            373:  %crc.cast = trunc i32 %checksum to i4 
# |            374:  %data.cast = trunc i32 %msg to i4 
# |            375:  %xor.crc.data1 = xor i4 %crc.cast, %data.cast 
# |            376:  %tcbits.cast = zext i4 %xor.crc.data1 to i8 
# |            377:  %clmul.mu = call i8 @llvm.clmul.i8(i8 %tcbits.cast, i8 17) 
# |            378:  %quot.mask = and i8 %clmul.mu, 15 
# |            379:  %quot.cast = zext i8 %quot.mask to i36 
# |            380:  %clmul.gp = call i36 @llvm.clmul.i36(i36 %quot.cast, i36 67601) 
# |            381:  %crc.recast = zext i32 %checksum to i36 
# | next:1084'1      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   error: match on wrong line
# |            382:  %xor.crc.mult = xor i36 %crc.recast, %clmul.gp 
# |            383:  %crc.lshr2 = lshr i36 %xor.crc.mult, 4 
# |            384:  %crc.next3 = trunc i36 %crc.lshr2 to i32 
# |            385:  br label %loop 
# |            386:  
# |              .
# |              .
# |              .
# |            391:  %crc.next.lcssa = phi i32 [ %crc.next3, %loop ] 
# |            392:  ret i32 %crc.next.lcssa 
# |            393: } 
# |            394:  
# |            395: ; Function Attrs: optsize 
# |            396: define i32 @crc32.le.tc30.data32(i32 %checksum, i32 %msg) #0 { 
# | next:1084'2                                      }                               search range end (exclusive)
# |            397: entry: 
# | next:1149'0          {   search range start (exclusive)
# |            398:  %crc.cast = trunc i32 %checksum to i30 
# |            399:  %data.cast = trunc i32 %msg to i30 
# |            400:  %xor.crc.data1 = xor i30 %crc.cast, %data.cast 
# |            401:  %tcbits.cast = zext i30 %xor.crc.data1 to i60 
# |            402:  %clmul.mu = call i60 @llvm.clmul.i60(i60 %tcbits.cast, i60 475535633) 
# |            403:  %quot.mask = and i60 %clmul.mu, 1073741823 
# |            404:  %quot.cast = zext i60 %quot.mask to i62 
# |            405:  %clmul.gp = call i62 @llvm.clmul.i62(i62 %quot.cast, i62 67601) 
# |            406:  %crc.recast = zext i32 %checksum to i62 
# | next:1149'1      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   error: match on wrong line
# |            407:  %xor.crc.mult = xor i62 %crc.recast, %clmul.gp 
# |            408:  %crc.lshr2 = lshr i62 %xor.crc.mult, 30 
# |            409:  %crc.next3 = trunc i62 %crc.lshr2 to i32 
# |            410:  br label %loop 
# |            411:  
# |              .
# |              .
# |              .
# |            416:  %crc.next.lcssa = phi i32 [ %crc.next3, %loop ] 
# |            417:  ret i32 %crc.next.lcssa 
# |            418: } 
# |            419:  
# |            420: ; Function Attrs: optsize 
# |            421: define i32 @crc.disabled.optsize(i32 %checksum, i32 %msg) #0 { 
# | next:1149'2                                      }                               search range end (exclusive)
# |            422: entry: 
# |            423:  %crc.cast = trunc i32 %checksum to i8 
# |            424:  %data.cast = trunc i32 %msg to i8 
# |            425:  %xor.crc.data1 = xor i8 %crc.cast, %data.cast 
# |            426:  %tcbits.cast = zext i8 %xor.crc.data1 to i16 
# |              .
# |              .
# |              .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

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


More information about the llvm-commits mailing list