[llvm] [InstCombine] Support multi-use values in cast elimination transforms (PR #165877)

via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 21 06:33:13 PST 2025


github-actions[bot] wrote:

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

* 166218 tests passed
* 2853 tests skipped
* 1 test failed

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

### LLVM
<details>
<summary>LLVM.Transforms/InstCombine/known-bits-lerp-pattern.ll</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/known-bits-lerp-pattern.ll -passes=instcombine -S | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/known-bits-lerp-pattern.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt -passes=instcombine -S
# 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/Transforms/InstCombine/known-bits-lerp-pattern.ll
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/known-bits-lerp-pattern.ll:35:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: [[A32:%.*]] = zext i8 [[A]] to i32
# |               ^
# | <stdin>:15:49: note: scanning from here
# | define i1 @test_trunc_cmp(i8 %a, i8 %c, i8 %d) {
# |                                                 ^
# | <stdin>:15:49: note: with "A" equal to "%a"
# | define i1 @test_trunc_cmp(i8 %a, i8 %c, i8 %d) {
# |                                                 ^
# | <stdin>:16:2: note: possible intended match here
# |  %a32 = zext i8 %a to i16
# |  ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/known-bits-lerp-pattern.ll:60:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: [[A32:%.*]] = zext i8 [[A]] to i32
# |               ^
# | <stdin>:27:53: note: scanning from here
# | define i1 @test_trunc_cmp_xor(i8 %a, i8 %c, i8 %d) {
# |                                                     ^
# | <stdin>:27:53: note: with "A" equal to "%a"
# | define i1 @test_trunc_cmp_xor(i8 %a, i8 %c, i8 %d) {
# |                                                     ^
# | <stdin>:28:2: note: possible intended match here
# |  %a32 = zext i8 %a to i16
# |  ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/known-bits-lerp-pattern.ll:85:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: [[A32:%.*]] = zext i8 [[A]] to i32
# |               ^
# | <stdin>:39:68: note: scanning from here
# | define i1 @test_trunc_cmp_arbitrary_b(i8 %a, i8 %b, i8 %c, i8 %d) {
# |                                                                    ^
# | <stdin>:39:68: note: with "A" equal to "%a"
# | define i1 @test_trunc_cmp_arbitrary_b(i8 %a, i8 %b, i8 %c, i8 %d) {
# |                                                                    ^
# | <stdin>:40:2: note: possible intended match here
# |  %a32 = zext i8 %a to i16
# |  ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/known-bits-lerp-pattern.ll:113:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: [[B32:%.*]] = zext i8 [[B]] to i32
# |               ^
# | <stdin>:52:54: note: scanning from here
# | define i1 @test_trunc_cmp_no_a(i8 %b, i8 %c, i8 %d) {
# |                                                      ^
# | <stdin>:52:54: note: with "B" equal to "%b"
# | define i1 @test_trunc_cmp_no_a(i8 %b, i8 %c, i8 %d) {
# |                                                      ^
# | <stdin>:53:2: note: possible intended match here
# |  %b32 = zext i8 %b to i16
# |  ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/known-bits-lerp-pattern.ll:136:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: [[A32:%.*]] = zext i8 [[A]] to i32
# |               ^
# | <stdin>:63:54: note: scanning from here
# | define i1 @test_trunc_cmp_no_d(i8 %a, i8 %b, i8 %c) {
# |                                                      ^
# | <stdin>:63:54: note: with "A" equal to "%a"
# | define i1 @test_trunc_cmp_no_d(i8 %a, i8 %b, i8 %c) {
# |                                                      ^
# | <stdin>:64:2: note: possible intended match here
# |  %a32 = zext i8 %a to i16
# |  ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/known-bits-lerp-pattern.ll:159:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: [[A32:%.*]] = zext i8 [[A]] to i32
# |               ^
# | <stdin>:74:62: note: scanning from here
# | define i1 @test_trunc_cmp_xor_negative(i8 %a, i8 %c, i8 %d) {
# |                                                              ^
# | <stdin>:74:62: note: with "A" equal to "%a"
# | define i1 @test_trunc_cmp_xor_negative(i8 %a, i8 %c, i8 %d) {
# |                                                              ^
# | <stdin>:75:2: note: possible intended match here
# |  %a32 = zext i8 %a to i16
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/InstCombine/known-bits-lerp-pattern.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            10:  %mul2 = mul nuw nsw i32 %c32, %d32 
# |            11:  %add = add nuw nsw i32 %mul1, %mul2 
# |            12:  ret i32 %add 
# |            13: } 
# |            14:  
# |            15: define i1 @test_trunc_cmp(i8 %a, i8 %c, i8 %d) { 
# | next:35'0                                                      X error: no match found
# | next:35'1                                                        with "A" equal to "%a"
# |            16:  %a32 = zext i8 %a to i16 
# | next:35'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:35'2       ?                         possible intended match
# |            17:  %c32 = zext i8 %c to i16 
# | next:35'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            18:  %d32 = zext i8 %d to i16 
# | next:35'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            19:  %sub = xor i16 %c32, 255 
# | next:35'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            20:  %mul1 = mul nuw i16 %sub, %a32 
# | next:35'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            21:  %mul2 = mul nuw i16 %c32, %d32 
# | next:35'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            22:  %add = add i16 %mul1, %mul2 
# | next:35'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            23:  %cmp = icmp eq i16 %add, 1234 
# | next:35'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            24:  ret i1 %cmp 
# | next:35'0      ~~~~~~~~~~~~~
# |            25: } 
# | next:35'0      ~~
# |            26:  
# | next:35'0      ~
# |            27: define i1 @test_trunc_cmp_xor(i8 %a, i8 %c, i8 %d) { 
# | next:35'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:60'0                                                          X error: no match found
# | next:60'1                                                            with "A" equal to "%a"
# |            28:  %a32 = zext i8 %a to i16 
# | next:60'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:60'2       ?                         possible intended match
# |            29:  %c32 = zext i8 %c to i16 
# | next:60'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            30:  %d32 = zext i8 %d to i16 
# | next:60'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            31:  %sub = xor i16 %c32, 255 
# | next:60'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            32:  %mul1 = mul nuw i16 %sub, %a32 
# | next:60'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            33:  %mul2 = mul nuw i16 %c32, %d32 
# | next:60'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            34:  %add = add i16 %mul1, %mul2 
# | next:60'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            35:  %cmp = icmp eq i16 %add, 1234 
# | next:60'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            36:  ret i1 %cmp 
# | next:60'0      ~~~~~~~~~~~~~
# |            37: } 
# | next:60'0      ~~
# |            38:  
# | next:60'0      ~
# |            39: define i1 @test_trunc_cmp_arbitrary_b(i8 %a, i8 %b, i8 %c, i8 %d) { 
# | next:60'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:85'0                                                                         X error: no match found
# | next:85'1                                                                           with "A" equal to "%a"
# |            40:  %a32 = zext i8 %a to i16 
# | next:85'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:85'2       ?                         possible intended match
# |            41:  %b32 = zext i8 %b to i16 
# | next:85'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            42:  %c32 = zext i8 %c to i16 
# | next:85'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            43:  %d32 = zext i8 %d to i16 
# | next:85'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            44:  %sub = sub nsw i16 %b32, %c32 
# | next:85'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            45:  %mul1 = mul i16 %sub, %a32 
# | next:85'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            46:  %mul2 = mul nuw i16 %c32, %d32 
# | next:85'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            47:  %add = add i16 %mul1, %mul2 
# | next:85'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            48:  %cmp = icmp eq i16 %add, 1234 
# | next:85'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            49:  ret i1 %cmp 
# | next:85'0      ~~~~~~~~~~~~~
# |            50: } 
# | next:85'0      ~~
# |            51:  
# | next:85'0      ~
# |            52: define i1 @test_trunc_cmp_no_a(i8 %b, i8 %c, i8 %d) { 
# | next:85'0      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:113'0                                                          X error: no match found
# | next:113'1                                                            with "B" equal to "%b"
# |            53:  %b32 = zext i8 %b to i16 
# | next:113'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:113'2      ?                         possible intended match
# |            54:  %c32 = zext i8 %c to i16 
# | next:113'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            55:  %d32 = zext i8 %d to i16 
# | next:113'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            56:  %sub = sub nsw i16 %b32, %c32 
# | next:113'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            57:  %mul2 = mul nuw i16 %c32, %d32 
# | next:113'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            58:  %add = add i16 %sub, %mul2 
# | next:113'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            59:  %cmp = icmp eq i16 %add, 1234 
# | next:113'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            60:  ret i1 %cmp 
# | next:113'0     ~~~~~~~~~~~~~
# |            61: } 
# | next:113'0     ~~
# |            62:  
# | next:113'0     ~
# |            63: define i1 @test_trunc_cmp_no_d(i8 %a, i8 %b, i8 %c) { 
# | next:113'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:136'0                                                          X error: no match found
# | next:136'1                                                            with "A" equal to "%a"
# |            64:  %a32 = zext i8 %a to i16 
# | next:136'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:136'2      ?                         possible intended match
# |            65:  %b32 = zext i8 %b to i16 
# | next:136'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            66:  %c32 = zext i8 %c to i16 
# | next:136'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            67:  %sub = sub nsw i16 %b32, %c32 
# | next:136'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            68:  %mul1 = mul i16 %sub, %a32 
# | next:136'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            69:  %add = add i16 %mul1, %c32 
# | next:136'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            70:  %cmp = icmp eq i16 %add, 1234 
# | next:136'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            71:  ret i1 %cmp 
# | next:136'0     ~~~~~~~~~~~~~
# |            72: } 
# | next:136'0     ~~
# |            73:  
# | next:136'0     ~
# |            74: define i1 @test_trunc_cmp_xor_negative(i8 %a, i8 %c, i8 %d) { 
# | next:136'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:159'0                                                                  X error: no match found
# | next:159'1                                                                    with "A" equal to "%a"
# |            75:  %a32 = zext i8 %a to i16 
# | next:159'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:159'2      ?                         possible intended match
# |            76:  %c32 = zext i8 %c to i16 
# | next:159'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            77:  %d32 = zext i8 %d to i16 
# | next:159'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            78:  %sub = xor i16 %c32, 234 
# | next:159'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            79:  %mul1 = mul nuw i16 %sub, %a32 
# | next:159'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            80:  %mul2 = mul nuw i16 %c32, %d32 
# | next:159'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/165877


More information about the llvm-commits mailing list