[llvm] [InstCombine] Reuse with.overflow result for matching add/sub (PR #198992)

via llvm-commits llvm-commits at lists.llvm.org
Thu May 21 04:13:50 PDT 2026


github-actions[bot] wrote:

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

* 134951 tests passed
* 3304 tests skipped
* 1 test failed

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

### LLVM
<details>
<summary>LLVM.Transforms/InstCombine/with-overflow-recompute.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\with-overflow-recompute.ll -passes=instcombine -S | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\with-overflow-recompute.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\with-overflow-recompute.ll'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\with-overflow-recompute.ll:41:15: error: CHECK-NEXT: is not on the line after the previous match
# | ; CHECK-NEXT: [[OVERFLOW:%.*]] = extractvalue { i32, i1 } [[PAIR]], 1
# |               ^
# | <stdin>:42:2: note: 'next' match was here
# |  %overflow = extractvalue { i32, i1 } %pair, 1
# |  ^
# | <stdin>:40:71: note: previous match ended here
# |  %pair = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %a, i32 %b)
# |                                                                       ^
# | <stdin>:41:1: note: non-matching line after previous match is here
# |  %with.overflow.result = extractvalue { i32, i1 } %pair, 0
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\with-overflow-recompute.ll:59:15: error: CHECK-NEXT: is not on the line after the previous match
# | ; CHECK-NEXT: [[OVERFLOW:%.*]] = extractvalue { i32, i1 } [[PAIR]], 1
# |               ^
# | <stdin>:51:2: note: 'next' match was here
# |  %overflow = extractvalue { i32, i1 } %pair, 1
# |  ^
# | <stdin>:49:71: note: previous match ended here
# |  %pair = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 %a, i32 %b)
# |                                                                       ^
# | <stdin>:50:1: note: non-matching line after previous match is here
# |  %with.overflow.result = extractvalue { i32, i1 } %pair, 0
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\with-overflow-recompute.ll:77:15: error: CHECK-NEXT: is not on the line after the previous match
# | ; CHECK-NEXT: [[OVERFLOW:%.*]] = extractvalue { i64, i1 } [[PAIR]], 1
# |               ^
# | <stdin>:60:2: note: 'next' match was here
# |  %overflow = extractvalue { i64, i1 } %pair, 1
# |  ^
# | <stdin>:58:71: note: previous match ended here
# |  %pair = call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %a, i64 %b)
# |                                                                       ^
# | <stdin>:59:1: note: non-matching line after previous match is here
# |  %with.overflow.result = extractvalue { i64, i1 } %pair, 0
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\with-overflow-recompute.ll:95:15: error: CHECK-NEXT: is not on the line after the previous match
# | ; CHECK-NEXT: [[OVERFLOW:%.*]] = extractvalue { <4 x i32>, <4 x i1> } [[PAIR]], 1
# |               ^
# | <stdin>:69:2: note: 'next' match was here
# |  %overflow = extractvalue { <4 x i32>, <4 x i1> } %pair, 1
# |  ^
# | <stdin>:67:97: note: previous match ended here
# |  %pair = call { <4 x i32>, <4 x i1> } @llvm.uadd.with.overflow.v4i32(<4 x i32> %a, <4 x i32> %b)
# |                                                                                                 ^
# | <stdin>:68:1: note: non-matching line after previous match is here
# |  %with.overflow.result = extractvalue { <4 x i32>, <4 x i1> } %pair, 0
# | ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\llvm\test\Transforms\InstCombine\with-overflow-recompute.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |          .
# |          .
# |          .
# |         37:  
# |         38: define i32 @sadd_plain_recompute(i32 %a, i32 %b) { 
# |         39: entry: 
# |         40:  %pair = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %a, i32 %b) 
# |         41:  %with.overflow.result = extractvalue { i32, i1 } %pair, 0 
# |         42:  %overflow = extractvalue { i32, i1 } %pair, 1 
# | next:41      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
# |         43:  call void @use.i1(i1 %overflow) 
# |         44:  ret i32 %with.overflow.result 
# |         45: } 
# |         46:  
# |         47: define i32 @uadd_commuted_recompute(i32 %a, i32 %b) { 
# |         48: entry: 
# |         49:  %pair = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 %a, i32 %b) 
# |         50:  %with.overflow.result = extractvalue { i32, i1 } %pair, 0 
# |         51:  %overflow = extractvalue { i32, i1 } %pair, 1 
# | next:59      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
# |         52:  call void @use.i1(i1 %overflow) 
# |         53:  ret i32 %with.overflow.result 
# |         54: } 
# |         55:  
# |         56: define i64 @uadd_i64_plain_recompute(i64 %a, i64 %b) { 
# |         57: entry: 
# |         58:  %pair = call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %a, i64 %b) 
# |         59:  %with.overflow.result = extractvalue { i64, i1 } %pair, 0 
# |         60:  %overflow = extractvalue { i64, i1 } %pair, 1 
# | next:77      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
# |         61:  call void @use.i1(i1 %overflow) 
# |         62:  ret i64 %with.overflow.result 
# |         63: } 
# |         64:  
# |         65: define <4 x i32> @uadd_vector_plain_recompute(<4 x i32> %a, <4 x i32> %b) { 
# |         66: entry: 
# |         67:  %pair = call { <4 x i32>, <4 x i1> } @llvm.uadd.with.overflow.v4i32(<4 x i32> %a, <4 x i32> %b) 
# |         68:  %with.overflow.result = extractvalue { <4 x i32>, <4 x i1> } %pair, 0 
# |         69:  %overflow = extractvalue { <4 x i32>, <4 x i1> } %pair, 1 
# | next:95      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
# |         70:  call void @use.v4i1(<4 x i1> %overflow) 
# |         71:  ret <4 x i32> %with.overflow.result 
# |         72: } 
# |         73:  
# |         74: define i32 @usub_plain_recompute(i32 %a, i32 %b) { 
# |          .
# |          .
# |          .
# | >>>>>>
# `-----------------------------
# 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/198992


More information about the llvm-commits mailing list