[llvm] [SelectionDAG] constant division fallback for existing Constant Division optimization (PR #188402)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 24 20:28:33 PDT 2026


github-actions[bot] wrote:

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

* 171718 tests passed
* 3070 tests skipped
* 3 tests failed

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

### LLVM
<details>
<summary>LLVM.CodeGen/AArch64/rem-by-const.ll</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=aarch64-none-eabi -global-isel=0 -verify-machineinstrs /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AArch64/rem-by-const.ll -o - | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AArch64/rem-by-const.ll --check-prefixes=CHECK,CHECK-SD
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=aarch64-none-eabi -global-isel=0 -verify-machineinstrs /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AArch64/rem-by-const.ll -o -
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AArch64/rem-by-const.ll --check-prefixes=CHECK,CHECK-SD
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AArch64/rem-by-const.ll:70:18: error: CHECK-SD-NEXT: expected string not found in input
# | ; CHECK-SD-NEXT: mov w8, #37 // =0x25
# |                  ^
# | <stdin>:46:20: note: scanning from here
# | // %bb.0: // %entry
# |                    ^
# | <stdin>:47:2: note: possible intended match here
# |  mov w8, #293 // =0x125
# |  ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AArch64/rem-by-const.ll:190:18: error: CHECK-SD-NEXT: expected string not found in input
# | ; CHECK-SD-NEXT: and w9, w0, #0xffff
# |                  ^
# | <stdin>:117:26: note: scanning from here
# |  mov w8, #9363 // =0x2493
# |                          ^
# | <stdin>:119:2: note: possible intended match here
# |  and x9, x0, #0xffff
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/AArch64/rem-by-const.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            41:  .globl ui8_7 // -- Begin function ui8_7 
# |            42:  .p2align 2 
# |            43:  .type ui8_7, at function 
# |            44: ui8_7: // @ui8_7 
# |            45:  .cfi_startproc 
# |            46: // %bb.0: // %entry 
# | next:70'0                         X error: no match found
# |            47:  mov w8, #293 // =0x125 
# | next:70'0      ~~~~~~~~~~~~~~~~~~~~~~~~
# | next:70'1       ?                       possible intended match
# |            48:  and w9, w0, #0xff 
# | next:70'0      ~~~~~~~~~~~~~~~~~~~
# |            49:  mul w8, w9, w8 
# | next:70'0      ~~~~~~~~~~~~~~~~
# |            50:  lsr w8, w8, #11 
# | next:70'0      ~~~~~~~~~~~~~~~~~
# |            51:  sub w8, w8, w8, lsl #3 
# | next:70'0      ~~~~~~~~~~~~~~~~~~~~~~~~
# |            52:  add w0, w0, w8 
# | next:70'0      ~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# |           112:  .p2align 2 
# |           113:  .type ui16_7, at function 
# |           114: ui16_7: // @ui16_7 
# |           115:  .cfi_startproc 
# |           116: // %bb.0: // %entry 
# |           117:  mov w8, #9363 // =0x2493 
# | next:190'0                              X error: no match found
# |           118:  // kill: def $w0 killed $w0 def $x0 
# | next:190'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           119:  and x9, x0, #0xffff 
# | next:190'0     ~~~~~~~~~~~~~~~~~~~~~
# | next:190'1      ?                    possible intended match
# |           120:  movk w8, #1, lsl #16 
# | next:190'0     ~~~~~~~~~~~~~~~~~~~~~~
# |           121:  umull x8, w9, w8 
# | next:190'0     ~~~~~~~~~~~~~~~~~~
# |           122:  lsr x8, x8, #19 
# | next:190'0     ~~~~~~~~~~~~~~~~~
# |           123:  sub w8, w8, w8, lsl #3 
# | next:190'0     ~~~~~~~~~~~~~~~~~~~~~~~~
# |           124:  add w0, w0, w8 
# | next:190'0     ~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>LLVM.CodeGen/RISCV/div-by-constant.ll</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=riscv32 -mattr=+m -verify-machineinstrs < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/div-by-constant.ll    | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck -check-prefixes=RV32,RV32IM /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/div-by-constant.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=riscv32 -mattr=+m -verify-machineinstrs
# 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=RV32,RV32IM /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/div-by-constant.ll
# note: command had no output on stdout or stderr
# RUN: at line 4
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=riscv32 -mattr=+m,+zba,+zbb     -verify-machineinstrs < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/div-by-constant.ll    | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck -check-prefixes=RV32,RV32IMZB /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/div-by-constant.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=riscv32 -mattr=+m,+zba,+zbb -verify-machineinstrs
# 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=RV32,RV32IMZB /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/div-by-constant.ll
# note: command had no output on stdout or stderr
# RUN: at line 7
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=riscv64 -mattr=+m -verify-machineinstrs < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/div-by-constant.ll    | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck -check-prefixes=RV64,RV64IM /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/div-by-constant.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=riscv64 -mattr=+m -verify-machineinstrs
# 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=RV64,RV64IM /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/div-by-constant.ll
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/div-by-constant.ll:250:16: error: RV64IM-NEXT: expected string not found in input
# | ; RV64IM-NEXT: zext.b a1, a0
# |                ^
# | <stdin>:90:9: note: scanning from here
# | # %bb.0:
# |         ^
# | <stdin>:91:2: note: possible intended match here
# |  zext.b a0, a0
# |  ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/div-by-constant.ll:314:14: error: RV64-NEXT: expected string not found in input
# | ; RV64-NEXT: slli a1, a0, 48
# |              ^
# | <stdin>:117:9: note: scanning from here
# | # %bb.0:
# |         ^
# | <stdin>:120:2: note: possible intended match here
# |  slli a0, a0, 48
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/RISCV/div-by-constant.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            85:  # -- End function 
# |            86:  .globl udiv8_constant_add # -- Begin function udiv8_constant_add 
# |            87:  .p2align 2 
# |            88:  .type udiv8_constant_add, at function 
# |            89: udiv8_constant_add: # @udiv8_constant_add 
# |            90: # %bb.0: 
# | next:250'0             X error: no match found
# |            91:  zext.b a0, a0 
# | next:250'0     ~~~~~~~~~~~~~~~
# | next:250'1      ?              possible intended match
# |            92:  li a1, 293 
# | next:250'0     ~~~~~~~~~~~~
# |            93:  mul a0, a0, a1 
# | next:250'0     ~~~~~~~~~~~~~~~~
# |            94:  srli a0, a0, 11 
# | next:250'0     ~~~~~~~~~~~~~~~~~
# |            95:  ret 
# | next:250'0     ~~~~~
# |            96: .Lfunc_end5: 
# | next:250'0     ~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# |           112:  # -- End function 
# |           113:  .globl udiv16_constant_add # -- Begin function udiv16_constant_add 
# |           114:  .p2align 2 
# |           115:  .type udiv16_constant_add, at function 
# |           116: udiv16_constant_add: # @udiv16_constant_add 
# |           117: # %bb.0: 
# | next:314'0             X error: no match found
# |           118:  lui a1, 74899 
# | next:314'0     ~~~~~~~~~~~~~~~
# |           119:  slli a1, a1, 4 
# | next:314'0     ~~~~~~~~~~~~~~~~
# |           120:  slli a0, a0, 48 
# | next:314'0     ~~~~~~~~~~~~~~~~~
# | next:314'1      ?                possible intended match
# |           121:  mulhu a0, a0, a1 
# | next:314'0     ~~~~~~~~~~~~~~~~~~
# |           122:  srli a0, a0, 19 
# | next:314'0     ~~~~~~~~~~~~~~~~~
# |           123:  ret 
# | next:314'0     ~~~~~
# |           124: .Lfunc_end7: 
# | next:314'0     ~~~~~~~~~~~~~
# |           125:  .size udiv16_constant_add, .Lfunc_end7-udiv16_constant_add 
# | next:314'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>LLVM.CodeGen/X86/rotate-extract.ll</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/rotate-extract.ll -mtriple=i686-unknown-unknown | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/rotate-extract.ll --check-prefix=X86
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=i686-unknown-unknown
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/rotate-extract.ll --check-prefix=X86
# note: command had no output on stdout or stderr
# RUN: at line 3
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/rotate-extract.ll -mtriple=x86_64-unknown-unknown | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/rotate-extract.ll --check-prefix=X64
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=x86_64-unknown-unknown
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/rotate-extract.ll --check-prefix=X64
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/rotate-extract.ll:243:13: error: X64-NEXT: expected string not found in input
# | ; X64-NEXT: imull $79, %ecx, %edx
# |             ^
# | <stdin>:119:15: note: scanning from here
# |  shrl $8, %eax
# |               ^
# | <stdin>:120:2: note: possible intended match here
# |  imull $335, %ecx, %ecx # imm = 0x14F
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/rotate-extract.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |           114:  .type no_extract_udiv, at function 
# |           115: no_extract_udiv: # @no_extract_udiv 
# |           116: # %bb.0: 
# |           117:  movzbl %dil, %ecx 
# |           118:  imull $171, %ecx, %eax 
# |           119:  shrl $8, %eax 
# | next:243'0                   X error: no match found
# |           120:  imull $335, %ecx, %ecx # imm = 0x14F 
# | next:243'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:243'1      ?                                     possible intended match
# |           121:  shrl $14, %ecx 
# | next:243'0     ~~~~~~~~~~~~~~~~
# |           122:  shlb $3, %al 
# | next:243'0     ~~~~~~~~~~~~~~
# |           123:  andb $-16, %al 
# | next:243'0     ~~~~~~~~~~~~~~~~
# |           124:  orb %cl, %al 
# | next:243'0     ~~~~~~~~~~~~~~
# |           125:  # kill: def $al killed $al killed $eax 
# | next:243'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# 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/188402


More information about the llvm-commits mailing list