[llvm] [SCEV] Rework wrap-flag-inferrence in zext-addrec (PR #217405)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 16:51:19 PDT 2026


artagnon wrote:

Hm, there seem to be failures in LLVM.Other, which is testing with the new-pm. On main as well as with this patch:

```
Printing analysis 'Scalar Evolution Analysis' for function 'foo':
Classifying expressions for: @foo
  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
  -->  {0,+,1}<nuw><%loop> U: full-set S: full-set              Exits: %n              LoopDispositions: { %loop: Computable }
  %iv.next = add i32 %iv, 1
  -->  {1,+,1}<nw><%loop> U: full-set S: full-set               Exits: (1 + %n)        LoopDispositions: { %loop: Computable }
Determining loop execution counts for: @foo
Loop %loop: backedge-taken count is %n
Loop %loop: constant max backedge-taken count is i32 -1
Loop %loop: symbolic max backedge-taken count is %n
Loop %loop: Trip multiple is 1
; ModuleID = '/tmp/scev.ll'
source_filename = "/tmp/scev.ll"

declare void @bar() local_unnamed_addr

define void @foo(i32 %n) local_unnamed_addr {
entry:
  br label %loop

loop:                                             ; preds = %loop, %entry
  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
  %iv.next = add i32 %iv, 1
  tail call void @bar()
  %cmp = icmp eq i32 %iv, %n
  br i1 %cmp, label %exit, label %loop

exit:                                             ; preds = %loop
  ret void
}
```

Here, the iv.next is given a nuw at the end of the pipeline? Is there some underlying issue outside SCEV?

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


More information about the llvm-commits mailing list