[llvm] Support OR and XOR in targetShrinkDemandedConstant (PR #165106)

via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 12:37:25 PDT 2026


github-actions[bot] wrote:

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

* 172368 tests passed
* 3134 tests skipped
* 5 tests failed

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

### LLVM
<details>
<summary>LLVM.CodeGen/ARM/and-cmpz.ll</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=thumbv7m-linux-gnu < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/and-cmpz.ll | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/and-cmpz.ll --check-prefix=CHECK --check-prefix=T2
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=thumbv7m-linux-gnu
# 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/ARM/and-cmpz.ll --check-prefix=CHECK --check-prefix=T2
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/and-cmpz.ll:95:7: error: T2: expected string not found in input
# | ; T2: and r0, r0, #65024
# |       ^
# | <stdin>:111:10: note: scanning from here
# | i16_cmpz: @ @i16_cmpz
# |          ^
# | <stdin>:116:4: note: possible intended match here
# |  cmp.w r2, r0, lsr #9
# |    ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/and-cmpz.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |           106:  .globl i16_cmpz @ -- Begin function i16_cmpz 
# |           107:  .p2align 1 
# |           108:  .type i16_cmpz,%function 
# |           109:  .code 16 
# |           110:  .thumb_func 
# |           111: i16_cmpz: @ @i16_cmpz 
# | check:95'0              X~~~~~~~~~~~~ error: no match found
# |           112:  .fnstart 
# | check:95'0     ~~~~~~~~~~
# |           113: @ %bb.0: @ %entry 
# | check:95'0     ~~~~~~~~~~~~~~~~~~
# |           114:  uxth r0, r0 
# | check:95'0     ~~~~~~~~~~~~~
# |           115:  movs r2, #0 
# | check:95'0     ~~~~~~~~~~~~~
# |           116:  cmp.w r2, r0, lsr #9 
# | check:95'0     ~~~~~~~~~~~~~~~~~~~~~~
# | check:95'1        ?                   possible intended match
# |           117:  it ne 
# | check:95'0     ~~~~~~~
# |           118:  bxne lr 
# | check:95'0     ~~~~~~~~~
# |           119: .LBB5_1: @ %if.then 
# | check:95'0     ~~~~~~~~~~~~~~~~~~~~
# |           120:  movs r0, #0 
# | check:95'0     ~~~~~~~~~~~~~
# |           121:  bx r1 
# | check:95'0     ~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>LLVM.CodeGen/ARM/funnel-shift-rot.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/ARM/funnel-shift-rot.ll -mtriple=arm-eabi -mattr=+v6t2 | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/funnel-shift-rot.ll --check-prefixes=CHECK,SCALAR
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=arm-eabi -mattr=+v6t2
# 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/ARM/funnel-shift-rot.ll --check-prefixes=CHECK,SCALAR
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/funnel-shift-rot.ll:22:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: and r1, r0, #224
# |               ^
# | <stdin>:24:9: note: scanning from here
# | @ %bb.0:
# |         ^
# | <stdin>:26:2: note: possible intended match here
# |  lsl r0, r0, #3
# |  ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/funnel-shift-rot.ll:164:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: ubfx r1, r0, #3, #5
# |               ^
# | <stdin>:155:9: note: scanning from here
# | @ %bb.0:
# |         ^
# | <stdin>:158:6: note: possible intended match here
# |  orr r0, r1, r0, lsl #5
# |      ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/funnel-shift-rot.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            19:  .p2align 2 
# |            20:  .type rotl_i8_const_shift,%function 
# |            21:  .code 32 
# |            22: rotl_i8_const_shift: @ @rotl_i8_const_shift 
# |            23:  .fnstart 
# |            24: @ %bb.0: 
# | next:22'0              X error: no match found
# |            25:  uxtb r1, r0 
# | next:22'0      ~~~~~~~~~~~~~
# |            26:  lsl r0, r0, #3 
# | next:22'0      ~~~~~~~~~~~~~~~~
# | next:22'1       ?               possible intended match
# |            27:  orr r0, r0, r1, lsr #5 
# | next:22'0      ~~~~~~~~~~~~~~~~~~~~~~~~
# |            28:  bx lr 
# | next:22'0      ~~~~~~~
# |            29: .Lfunc_end0: 
# | next:22'0      ~~~~~~~~~~~~~
# |            30:  .size rotl_i8_const_shift, .Lfunc_end0-rotl_i8_const_shift 
# | next:22'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            31:  .fnend 
# | next:22'0      ~~~~~~~~
# |             .
# |             .
# |             .
# |           150:  .p2align 2 
# |           151:  .type rotr_i8_const_shift,%function 
# |           152:  .code 32 
# |           153: rotr_i8_const_shift: @ @rotr_i8_const_shift 
# |           154:  .fnstart 
# |           155: @ %bb.0: 
# | next:164'0             X error: no match found
# |           156:  uxtb r1, r0 
# | next:164'0     ~~~~~~~~~~~~~
# |           157:  lsr r1, r1, #3 
# | next:164'0     ~~~~~~~~~~~~~~~~
# |           158:  orr r0, r1, r0, lsl #5 
# | next:164'0     ~~~~~~~~~~~~~~~~~~~~~~~~
# | next:164'1          ?                   possible intended match
# |           159:  bx lr 
# | next:164'0     ~~~~~~~
# |           160: .Lfunc_end7: 
# | next:164'0     ~~~~~~~~~~~~~
# |           161:  .size rotr_i8_const_shift, .Lfunc_end7-rotr_i8_const_shift 
# | next:164'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           162:  .fnend 
# | next:164'0     ~~~~~~~~
# |           163:  @ -- End function 
# | next:164'0     ~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>LLVM.CodeGen/ARM/hoist-and-by-const-from-lshr-in-eqcmp-zero.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=armv6 < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/hoist-and-by-const-from-lshr-in-eqcmp-zero.ll | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/hoist-and-by-const-from-lshr-in-eqcmp-zero.ll --check-prefixes=ARM,ARM6
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=armv6
# 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/ARM/hoist-and-by-const-from-lshr-in-eqcmp-zero.ll --check-prefixes=ARM,ARM6
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/hoist-and-by-const-from-lshr-in-eqcmp-zero.ll:24:13: error: ARM-NEXT: expected string not found in input
# | ; ARM-NEXT: mov r2, #128
# |             ^
# | <stdin>:25:13: note: scanning from here
# |  uxtb r1, r1
# |             ^
# | <stdin>:27:2: note: possible intended match here
# |  mov r1, #1
# |  ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/hoist-and-by-const-from-lshr-in-eqcmp-zero.ll:125:13: error: ARM-NEXT: expected string not found in input
# | ; ARM-NEXT: mov r2, #32768
# |             ^
# | <stdin>:77:13: note: scanning from here
# |  uxth r1, r1
# |             ^
# | <stdin>:79:2: note: possible intended match here
# |  mov r1, #1
# |  ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/hoist-and-by-const-from-lshr-in-eqcmp-zero.ll:868:14: error: ARM6-NEXT: expected string not found in input
# | ; ARM6-NEXT: mov r2, #128
# |              ^
# | <stdin>:351:13: note: scanning from here
# |  uxtb r1, r1
# |             ^
# | <stdin>:352:6: note: possible intended match here
# |  lsl r0, r0, r1
# |      ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/hoist-and-by-const-from-lshr-in-eqcmp-zero.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            20:  .type scalar_i8_signbit_eq,%function 
# |            21:  .code 32 
# |            22: scalar_i8_signbit_eq: @ @scalar_i8_signbit_eq 
# |            23:  .fnstart 
# |            24: @ %bb.0: 
# |            25:  uxtb r1, r1 
# | next:24'0                  X error: no match found
# |            26:  lsl r0, r0, r1 
# | next:24'0      ~~~~~~~~~~~~~~~~
# |            27:  mov r1, #1 
# | next:24'0      ~~~~~~~~~~~~
# | next:24'1       ?           possible intended match
# |            28:  uxtb r0, r0 
# | next:24'0      ~~~~~~~~~~~~~
# |            29:  eor r0, r1, r0, lsr #7 
# | next:24'0      ~~~~~~~~~~~~~~~~~~~~~~~~
# |            30:  bx lr 
# | next:24'0      ~~~~~~~
# |            31: .Lfunc_end0: 
# | next:24'0      ~~~~~~~~~~~~~
# |            32:  .size scalar_i8_signbit_eq, .Lfunc_end0-scalar_i8_signbit_eq 
# | next:24'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# |            72:  .type scalar_i16_signbit_eq,%function 
# |            73:  .code 32 
# |            74: scalar_i16_signbit_eq: @ @scalar_i16_signbit_eq 
# |            75:  .fnstart 
# |            76: @ %bb.0: 
# |            77:  uxth r1, r1 
# | next:125'0                 X error: no match found
# |            78:  lsl r0, r0, r1 
# | next:125'0     ~~~~~~~~~~~~~~~~
# |            79:  mov r1, #1 
# | next:125'0     ~~~~~~~~~~~~
# | next:125'1      ?           possible intended match
# |            80:  uxth r0, r0 
# | next:125'0     ~~~~~~~~~~~~~
# |            81:  eor r0, r1, r0, lsr #15 
# | next:125'0     ~~~~~~~~~~~~~~~~~~~~~~~~~
# |            82:  bx lr 
# | next:125'0     ~~~~~~~
# |            83: .Lfunc_end3: 
# | next:125'0     ~~~~~~~~~~~~~
# |            84:  .size scalar_i16_signbit_eq, .Lfunc_end3-scalar_i16_signbit_eq 
# | next:125'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# |           346:  .type scalar_i8_signbit_ne,%function 
# |           347:  .code 32 
# |           348: scalar_i8_signbit_ne: @ @scalar_i8_signbit_ne 
# |           349:  .fnstart 
# |           350: @ %bb.0: 
# |           351:  uxtb r1, r1 
# | next:868'0                 X error: no match found
# |           352:  lsl r0, r0, r1 
# | next:868'0     ~~~~~~~~~~~~~~~~
# | next:868'1          ?           possible intended match
# |           353:  uxtb r0, r0 
# | next:868'0     ~~~~~~~~~~~~~
# |           354:  lsr r0, r0, #7 
# | next:868'0     ~~~~~~~~~~~~~~~~
# |           355:  bx lr 
# | next:868'0     ~~~~~~~
# |           356: .Lfunc_end17: 
# | next:868'0     ~~~~~~~~~~~~~~
# |           357:  .size scalar_i8_signbit_ne, .Lfunc_end17-scalar_i8_signbit_ne 
# | next:868'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>LLVM.CodeGen/ARM/sdiv-pow2-arm-size.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=armv7a -mattr=+hwdiv-arm /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/sdiv-pow2-arm-size.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/ARM/sdiv-pow2-arm-size.ll --check-prefixes=CHECK,DIV
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=armv7a -mattr=+hwdiv-arm /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/sdiv-pow2-arm-size.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/ARM/sdiv-pow2-arm-size.ll --check-prefixes=CHECK,DIV
# 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 -mtriple=armv7a -mattr=-hwdiv-arm /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/sdiv-pow2-arm-size.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/ARM/sdiv-pow2-arm-size.ll --check-prefixes=CHECK,NODIV
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=armv7a -mattr=-hwdiv-arm /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/sdiv-pow2-arm-size.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/ARM/sdiv-pow2-arm-size.ll --check-prefixes=CHECK,NODIV
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/sdiv-pow2-arm-size.ll:31:15: error: NODIV-NEXT: expected string not found in input
# | ; NODIV-NEXT: and r1, r0, #32768
# |               ^
# | <stdin>:43:18: note: scanning from here
# | @ %bb.0: @ %entry
# |                  ^
# | <stdin>:45:2: note: possible intended match here
# |  add r0, r0, r1, lsr #15
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/sdiv-pow2-arm-size.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |            .
# |            .
# |            .
# |           38:  .p2align 2 
# |           39:  .type f0,%function 
# |           40:  .code 32 
# |           41: f0: @ @f0 
# |           42:  .fnstart 
# |           43: @ %bb.0: @ %entry 
# | next:31'0                      X error: no match found
# |           44:  uxth r1, r0 
# | next:31'0     ~~~~~~~~~~~~~
# |           45:  add r0, r0, r1, lsr #15 
# | next:31'0     ~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:31'1      ?                        possible intended match
# |           46:  sxth r0, r0 
# | next:31'0     ~~~~~~~~~~~~~
# |           47:  asr r0, r0, #1 
# | next:31'0     ~~~~~~~~~~~~~~~~
# |           48:  bx lr 
# | next:31'0     ~~~~~~~
# |           49: .Lfunc_end1: 
# | next:31'0     ~~~~~~~~~~~~~
# |           50:  .size f0, .Lfunc_end1-f0 
# | next:31'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            .
# |            .
# |            .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>LLVM.CodeGen/ARM/sdiv-pow2-thumb-size.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=thumbv8 /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/sdiv-pow2-thumb-size.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/ARM/sdiv-pow2-thumb-size.ll --check-prefixes=CHECK,T2
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=thumbv8 /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/sdiv-pow2-thumb-size.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/ARM/sdiv-pow2-thumb-size.ll --check-prefixes=CHECK,T2
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/sdiv-pow2-thumb-size.ll:118:12: error: T2-NEXT: expected string not found in input
# | ; T2-NEXT: and r1, r0, #32768
# |            ^
# | <stdin>:97:18: note: scanning from here
# | @ %bb.0: @ %entry
# |                  ^
# | <stdin>:101:2: note: possible intended match here
# |  asrs r0, r0, #1
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/ARM/sdiv-pow2-thumb-size.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            92:  .type f4,%function 
# |            93:  .code 16 
# |            94:  .thumb_func 
# |            95: f4: @ @f4 
# |            96:  .fnstart 
# |            97: @ %bb.0: @ %entry 
# | next:118'0                      X error: no match found
# |            98:  uxth r1, r0 
# | next:118'0     ~~~~~~~~~~~~~
# |            99:  add.w r0, r0, r1, lsr #15 
# | next:118'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           100:  sxth r0, r0 
# | next:118'0     ~~~~~~~~~~~~~
# |           101:  asrs r0, r0, #1 
# | next:118'0     ~~~~~~~~~~~~~~~~~
# | next:118'1      ?                possible intended match
# |           102:  bx lr 
# | next:118'0     ~~~~~~~
# |           103: .Lfunc_end4: 
# | next:118'0     ~~~~~~~~~~~~~
# |           104:  .size f4, .Lfunc_end4-f4 
# | next:118'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           105:  .fnend 
# | next:118'0     ~~~~~~~~
# |           106:  @ -- End function 
# | next:118'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/165106


More information about the llvm-commits mailing list