[llvm] [SCEV] Prove NUW early using Backedge Guard. (PR #205935)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 25 15:59:47 PDT 2026


github-actions[bot] wrote:

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

* 176212 tests passed
* 3541 tests skipped
* 3 tests failed

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

### LLVM
<details>
<summary>LLVM.Analysis/ScalarEvolution/different-loops-recs.ll</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt -disable-output "-passes=print<scalar-evolution>" < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Analysis/ScalarEvolution/different-loops-recs.ll 2>&1 | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Analysis/ScalarEvolution/different-loops-recs.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt -disable-output '-passes=print<scalar-evolution>'
# 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/Analysis/ScalarEvolution/different-loops-recs.ll
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Analysis/ScalarEvolution/different-loops-recs.ll:335:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: --> {%a,+,1}<%loop1> U: full-set S: full-set Exits: (%a umax %c) LoopDispositions: { %loop1: Computable }
# |               ^
# | <stdin>:184:55: note: scanning from here
# |  %phi1 = phi i32 [ %a, %entry ], [ %phi1.inc, %loop1 ]
# |                                                       ^
# | <stdin>:185:2: note: possible intended match here
# |  --> {%a,+,1}<nuw><%loop1> U: full-set S: full-set Exits: (%a umax %c) LoopDispositions: { %loop1: Computable }
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Analysis/ScalarEvolution/different-loops-recs.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |           179: Loop %loop1: Unpredictable backedge-taken count. 
# |           180: Loop %loop1: Unpredictable constant max backedge-taken count.  
# |           181: Loop %loop1: Unpredictable symbolic max backedge-taken count.  
# |           182: Printing analysis 'Scalar Evolution Analysis' for function 'test_03': 
# |           183: Classifying expressions for: @test_03 
# |           184:  %phi1 = phi i32 [ %a, %entry ], [ %phi1.inc, %loop1 ] 
# | next:335'0                                                           X error: no match found
# |           185:  --> {%a,+,1}<nuw><%loop1> U: full-set S: full-set Exits: (%a umax %c) LoopDispositions: { %loop1: Computable } 
# | next:335'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:335'1      ?                                                                                                               possible intended match
# |           186:  %phi1.inc = add i32 %phi1, 1 
# | next:335'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           187:  --> {(1 + %a),+,1}<nw><%loop1> U: full-set S: full-set Exits: (1 + (%a umax %c)) LoopDispositions: { %loop1: Computable } 
# | next:335'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           188:  %phi2 = phi i32 [ %a, %loop1 ], [ %phi2.inc, %loop2 ] 
# | next:335'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           189:  --> {%a,+,2}<%loop2> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop2: Computable } 
# | next:335'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           190:  %phi2.inc = add i32 %phi2, 2 
# | next:335'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>LLVM.Analysis/ScalarEvolution/increasing-or-decreasing-iv.ll</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt -disable-output "-passes=print<scalar-evolution>" < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Analysis/ScalarEvolution/increasing-or-decreasing-iv.ll 2>&1 | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Analysis/ScalarEvolution/increasing-or-decreasing-iv.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt -disable-output '-passes=print<scalar-evolution>'
# 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/Analysis/ScalarEvolution/increasing-or-decreasing-iv.ll
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Analysis/ScalarEvolution/increasing-or-decreasing-iv.ll:178:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: --> {%start,+,%step}<%loop> U: [0,-892) S: [0,-892) Exits: ((127 * %step)<nuw> + %start) LoopDispositions: { %loop: Computable }
# |               ^
# | <stdin>:96:55: note: scanning from here
# |  %iv = phi i16 [ %start, %entry ], [ %iv.next, %loop ]
# |                                                       ^
# | <stdin>:97:2: note: possible intended match here
# |  --> {%start,+,%step}<nuw><%loop> U: [0,-892) S: [0,-892) Exits: ((127 * %step)<nuw> + %start) LoopDispositions: { %loop: Computable }
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Analysis/ScalarEvolution/increasing-or-decreasing-iv.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            91:  --> %start U: [0,1001) S: [0,1001) 
# |            92:  %step = select i1 %c, i16 1, i16 509 
# |            93:  --> %step U: [1,510) S: [1,510) 
# |            94:  %loop.iv = phi i16 [ 0, %entry ], [ %loop.iv.inc, %loop ] 
# |            95:  --> {0,+,1}<nuw><nsw><%loop> U: [0,128) S: [0,128) Exits: 127 LoopDispositions: { %loop: Computable } 
# |            96:  %iv = phi i16 [ %start, %entry ], [ %iv.next, %loop ] 
# | next:178'0                                                           X error: no match found
# |            97:  --> {%start,+,%step}<nuw><%loop> U: [0,-892) S: [0,-892) Exits: ((127 * %step)<nuw> + %start) LoopDispositions: { %loop: Computable } 
# | next:178'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:178'1      ?                                                                                                                                      possible intended match
# |            98:  %iv.zext = zext i16 %iv to i64 
# | next:178'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            99:  --> {(zext i16 %start to i64),+,(zext i16 %step to i64)}<nuw><%loop> U: [0,64644) S: [0,64644) Exits: ((zext i16 %start to i64) + (127 * (zext i16 %step to i64))<nuw><nsw>) LoopDispositions: { %loop: Computable } 
# | next:178'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           100:  %iv.next = add i16 %iv, %step 
# | next:178'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           101:  --> {(%step + %start),+,%step}<nw><%loop> U: full-set S: full-set Exits: ((128 * %step)<nuw> + %start) LoopDispositions: { %loop: Computable } 
# | next:178'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           102:  %loop.iv.inc = add i16 %loop.iv, 1 
# | next:178'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>LLVM.Transforms/LoopVectorize/iv-select-cmp-no-wrap.ll</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt -passes=loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -S < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/LoopVectorize/iv-select-cmp-no-wrap.ll | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/LoopVectorize/iv-select-cmp-no-wrap.ll --check-prefix=CHECK
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt -passes=loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -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/LoopVectorize/iv-select-cmp-no-wrap.ll --check-prefix=CHECK
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/LoopVectorize/iv-select-cmp-no-wrap.ll:255:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: [[TMP8:%.*]] = extractelement <4 x i64> [[BROADCAST_SPLAT]], i32 0
# |               ^
# | <stdin>:209:14: note: scanning from here
# | middle.block: ; preds = %vector.body
# |              ^
# | <stdin>:209:14: note: with "BROADCAST_SPLAT" equal to "%broadcast.splat"
# | middle.block: ; preds = %vector.body
# |              ^
# | <stdin>:210:2: note: possible intended match here
# |  %12 = extractelement <4 x i64> %broadcast.splat, i64 0
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Transforms/LoopVectorize/iv-select-cmp-no-wrap.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |           204:  %index.next = add nuw i64 %index, 4 
# |           205:  %vec.ind.next = add <4 x i64> %vec.ind, splat (i64 4) 
# |           206:  %11 = icmp eq i64 %index.next, %n.vec 
# |           207:  br i1 %11, label %middle.block, label %vector.body, !llvm.loop !8 
# |           208:  
# |           209: middle.block: ; preds = %vector.body 
# | next:255'0                  X~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# | next:255'1                                           with "BROADCAST_SPLAT" equal to "%broadcast.splat"
# |           210:  %12 = extractelement <4 x i64> %broadcast.splat, i64 0 
# | next:255'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:255'2      ?                                                       possible intended match
# |           211:  %13 = call i64 @llvm.experimental.vector.extract.last.active.v4i64(<4 x i64> %10, <4 x i1> %9, i64 %12) 
# | next:255'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           212:  %cmp.n = icmp eq i64 %0, %n.vec 
# | next:255'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           213:  br i1 %cmp.n, label %exit, label %scalar.ph 
# | next:255'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           214:  
# | next:255'0     ~
# |           215: scalar.ph: ; preds = %entry, %middle.block 
# | next:255'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/205935


More information about the llvm-commits mailing list