[llvm] [InstCombine] Fix i1 ssub.sat compare folding (PR #173742)

via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 27 14:10:24 PST 2025


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Windows-->
# :window: Windows x64 Test Results

* 128965 tests passed
* 2842 tests skipped
* 1 test failed

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

### LLVM
<details>
<summary>LLVM.Transforms/InstCombine/cmp-intrinsic.ll</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\opt.exe < C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\cmp-intrinsic.ll -passes=instcombine -S | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\cmp-intrinsic.ll
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\opt.exe' -passes=instcombine -S
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\cmp-intrinsic.ll'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\cmp-intrinsic.ll:899:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: [[NOTY:%.*]] = xor i1 [[Y:%.*]], true
# |               ^
# | <stdin>:503:32: note: scanning from here
# | define i1 @ssub_sat_i1_ne_zero(i1 %x, i1 %y) {
# |                                ^
# | C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\cmp-intrinsic.ll:921:15: error: CHECK-NEXT: is not on the line after the previous match
# | ; CHECK-NEXT: [[NOTX:%.*]] = xor i1 [[X:%.*]], true
# |               ^
# | <stdin>:516:2: note: 'next' match was here
# |  %r = xor i1 %m, true
# |  ^
# | <stdin>:514:32: note: previous match ended here
# | define i1 @ssub_sat_i1_eq_zero(i1 %x, i1 %y) {
# |                                ^
# | <stdin>:515:1: note: non-matching line after previous match is here
# |  %m = call i1 @llvm.ssub.sat.i1(i1 %x, i1 %y)
# | ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\cmp-intrinsic.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |           .
# |           .
# |           .
# |         498: define i1 @ssub_sat_ne_zero(i8 %x, i8 %y) { 
# |         499:  %r = icmp ne i8 %x, %y 
# |         500:  ret i1 %r 
# |         501: } 
# |         502:  
# |         503: define i1 @ssub_sat_i1_ne_zero(i1 %x, i1 %y) { 
# | next:899                                    X~~~~~~~~~~~~~~~ error: no match found
# |         504:  %m = call i1 @llvm.ssub.sat.i1(i1 %x, i1 %y) 
# | next:899     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |         505:  ret i1 %m 
# | next:899     ~~~~~~~~~~~
# |         506: } 
# | next:899     ~~
# |         507:  
# | next:899     ~
# |         508: define i1 @ssub_sat_ne_fail_nonzero(i8 %x, i8 %y) { 
# | next:899     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |         509:  %m = call i8 @llvm.ssub.sat.i8(i8 %x, i8 %y) 
# |         510:  %r = icmp ne i8 %m, 4 
# |         511:  ret i1 %r 
# |         512: } 
# |         513:  
# |         514: define i1 @ssub_sat_i1_eq_zero(i1 %x, i1 %y) { 
# |         515:  %m = call i1 @llvm.ssub.sat.i1(i1 %x, i1 %y) 
# |         516:  %r = xor i1 %m, true 
# | next:921      !~~~~~~~~~~~~~~~~~~~  error: match on wrong line
# |         517:  ret i1 %r 
# |         518: } 
# |         519:  
# |         520: define i1 @ssub_sat_eq_zero(i8 %x, i8 %y) { 
# |         521:  %r = icmp eq i8 %x, %y 
# |           .
# |           .
# |           .
# | >>>>>>
# `-----------------------------
# 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/173742


More information about the llvm-commits mailing list