[llvm] [InstCombine] Fold umin(mul/add(zext, zext), max) into overflow intrinsics (PR #221809)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 14:49:41 PDT 2026


github-actions[bot] wrote:

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

* 141634 tests passed
* 3256 tests skipped
* 1 test failed

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

### LLVM
<details>
<summary>LLVM.Transforms/InstCombine/saturating-add-sub.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\saturating-add-sub.ll -passes=instcombine -S | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\saturating-add-sub.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\saturating-add-sub.ll'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\saturating-add-sub.ll:3030:15: error: CHECK-NEXT: is not on the line after the previous match
# | ; CHECK-NEXT: [[ZA:%.*]] = zext i8 [[A:%.*]] to i16
# |               ^
# | <stdin>:1491:2: note: 'next' match was here
# |  %cmp = zext i8 %narrow to i16
# |  ^
# | <stdin>:1489:63: note: previous match ended here
# | define i8 @no_fold_umin_to_uadd_sat_if_has_multi_use_for_umin(i8 %a, i8 %b) {
# |                                                               ^
# | <stdin>:1490:1: note: non-matching line after previous match is here
# |  %narrow = call i8 @llvm.uadd.sat.i8(i8 %b, i8 %a)
# | ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\saturating-add-sub.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |              .
# |              .
# |              .
# |           1484:  %cmp = call i16 @llvm.umin.i16(i16 %add, i16 255) 
# |           1485:  %r = trunc nuw i16 %cmp to i8 
# |           1486:  ret i8 %r 
# |           1487: } 
# |           1488:  
# |           1489: define i8 @no_fold_umin_to_uadd_sat_if_has_multi_use_for_umin(i8 %a, i8 %b) { 
# | next:3030'0                                                                  {                  search range start (exclusive)
# |           1490:  %narrow = call i8 @llvm.uadd.sat.i8(i8 %b, i8 %a) 
# |           1491:  %cmp = zext i8 %narrow to i16 
# | next:3030'1      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~   error: match on wrong line
# |           1492:  call void @usei16(i16 %cmp) 
# |           1493:  ret i8 %narrow 
# |           1494: } 
# |           1495:  
# |           1496: define i8 @fold_umin_to_uadd_sat_if_has_multi_use_for_zext(i8 %a, i8 %b) { 
# | next:3030'2                                                                }                 search range end (exclusive)
# |           1497:  %za = zext i8 %a to i16 
# |           1498:  call void @usei16(i16 %za) 
# |           1499:  %narrow = call i8 @llvm.uadd.sat.i8(i8 %b, i8 %a) 
# |           1500:  ret i8 %narrow 
# |           1501: } 
# |              .
# |              .
# |              .
# | >>>>>>
# `-----------------------------
# 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/221809


More information about the llvm-commits mailing list