[llvm] [SCEV] Rewrite more SCEVAddExpr when applying guards. (PR #159942)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 27 08:49:42 PDT 2026


github-actions[bot] wrote:

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

* 179653 tests passed
* 3578 tests skipped
* 1 test failed

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

### LLVM
<details>
<summary>LLVM.Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.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='print<scalar-evolution>' -disable-output /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.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/max-backedge-taken-count-guard-info.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/opt '-passes=print<scalar-evolution>' -disable-output /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
# 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/max-backedge-taken-count-guard-info.ll
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll:1305:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%loop> U: [0,-2147483648) S: [0,-2147483648) Exits: (-1 + %N) LoopDispositions: { %loop: Computable }
# |               ^
# | <stdin>:527:50: note: scanning from here
# |  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
# |                                                  ^
# | <stdin>:528:2: note: possible intended match here
# |  --> {0,+,1}<nuw><nsw><%loop> U: [0,1) S: [0,1) Exits: 0 LoopDispositions: { %loop: Computable }
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |              .
# |              .
# |              .
# |            522: Loop %loop: Trip multiple is 1 
# |            523: Printing analysis 'Scalar Evolution Analysis' for function 'not_optimized_range_check_unsigned2': 
# |            524: Classifying expressions for: @not_optimized_range_check_unsigned2 
# |            525:  %N.off = add i32 %N, -1 
# |            526:  --> (-1 + %N) U: full-set S: full-set 
# |            527:  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ] 
# | next:1305'0                                                     {   search range start (exclusive)
# | next:1305'1                                                         error: no match found in search range
# |            528:  --> {0,+,1}<nuw><nsw><%loop> U: [0,1) S: [0,1) Exits: 0 LoopDispositions: { %loop: Computable } 
# | next:1305'2      ?                                                                                                 possible intended match
# |            529:  %gep = getelementptr inbounds i16, ptr %pred, i32 %iv 
# |            530:  --> {%pred,+,2}<nuw><%loop> U: full-set S: full-set Exits: %pred LoopDispositions: { %loop: Computable } 
# |            531:  %iv.next = add nuw nsw i32 %iv, 1 
# |            532:  --> {1,+,1}<nuw><nsw><%loop> U: [1,2) S: [1,2) Exits: 1 LoopDispositions: { %loop: Computable } 
# |            533: Determining loop execution counts for: @not_optimized_range_check_unsigned2 
# |            534: Loop %loop: backedge-taken count is i32 0 
# |            535: Loop %loop: constant max backedge-taken count is i32 0 
# |            536: Loop %loop: symbolic max backedge-taken count is i32 0 
# |            537: Loop %loop: Trip multiple is 1 
# |            538: Printing analysis 'Scalar Evolution Analysis' for function 'ptr_induction_ult_1': 
# | next:1305'3                                                                                     }   search range end (exclusive)
# |            539: Classifying expressions for: @ptr_induction_ult_1 
# |            540:  %ptr.iv = phi ptr [ %ptr.iv.next, %loop ], [ %a, %entry ] 
# |            541:  --> {%a,+,4}<nuw><nsw><%loop> U: full-set S: full-set Exits: %a LoopDispositions: { %loop: Computable } 
# |            542:  %ptr.iv.next = getelementptr i32, ptr %ptr.iv, i64 1 
# |            543:  --> {(4 + %a),+,4}<nw><%loop> U: full-set S: full-set Exits: (4 + %a) LoopDispositions: { %loop: Computable } 
# |              .
# |              .
# |              .
# | >>>>>>
# `-----------------------------
# 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/159942


More information about the llvm-commits mailing list