[llvm] [SCEV] Fix incorrect nw-inference in sext-addrec (PR #217782)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 01:01:21 PDT 2026


================
@@ -1,26 +1,37 @@
-; RUN: opt -disable-output "-passes=print<scalar-evolution>,print<scalar-evolution>" < %s 2>&1 | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 6
+; RUN: opt -disable-output -passes='print<scalar-evolution>' %s 2>&1 | FileCheck %s
 
 define void @bad.nsw() {
-; CHECK-LABEL: Classifying expressions for: @bad.nsw
-; CHECK-LABEL: Classifying expressions for: @bad.nsw
- entry: 
+; CHECK-LABEL: 'bad.nsw'
+; CHECK-NEXT:  Classifying expressions for: @bad.nsw
+; CHECK-NEXT:    %i = phi i8 [ -1, %entry ], [ %i.inc, %loop ]
+; CHECK-NEXT:    --> {-1,+,-128}<%loop> U: [-1,-128) S: [-1,-128) Exits: 127 LoopDispositions: { %loop: Computable }
----------------
fhahn wrote:

I might be missing something, but in unsigned, `%I` in the first iteration is 255, in the second 127, so no wrap around the start value? It would be a self wrap if there was another iteration.

https://github.com/llvm/llvm-project/pull/217782


More information about the llvm-commits mailing list